Well, now that the dust has settled this week I can get back to my CmdLet fun.
Over the week I did have some time to think about where this is all going. It dawned on me that the CmdLet design should not include anything about the design of the returned object. This wasn't evident to me at first and I was fretting about how to write that part up and still keep things simple. It's easy now - don't include it'
The objects(s) returned by a CmdLet are NOT part of the CmdLet even if the CmdLet generates them. They are objects that the CmdLet finds, selects or generates. After the CmdLet completes it's execution they exist independently.
Here is my first take at what this CmdLet should look like.
CmdLet Name: | Get-Computer | |
Parameters | Name | NetBIOS name, DNS name or array of string names |
IPAddress | Address in dot notation for input from pipeline | |
Domain | Switch parameter that extracts all computer names from the default domain | |
OU | aDSPath to OU containing computer objects | |
File | FileInfo object or string pathname of file with list of computer names | |
Verbose | [switch]Causes display of extra information for testing and debugging | |
Filter | [switch]Causes only pingable computers to be returned | |
Simple | [switch]Causes only names to be returned instead of Computer objects | |
Returns | Object | Returns a Computer object or a collection of Computer objects. Can also return a list of pingable computer names |
- | - | - |
The "Computer" object is a basic and simple test object. I have given it some of the elements that I will need to test it in a pipeline. After the CmdLet is functioning correctly I will go back to the computer object and add a world of functionality to it.
Computer Object
Properties: Name, IPAddress, DNSAddress, OS, OSVersion, IsPingable, Services, [Future-Products, Accounts, ADInfo, ConsoleUser, TSUsers]
Methods: StartService, RestartService, StopService, Install,UnInstall, Shutdown, Restart, GPUpdate, [others not yet selected]
The initial test version only has Services available but this is enough for testing.
Test Code
I will post the test code here tomorrow after I have found a place to park it for download - blogspot doesn't allow uploading of files or images.)
No comments:
Post a Comment