I am creating a module for PowerShell that works with the McAfee ePO API. Currently all of these commands will need to be passed the same set of parameters (-ComputerName, -Credential, -Port, etc) in addition to any parameters needed by the particular API call. Some of these command lines are very “busy” looking.
I ask you, oh learned gurus of PowerShell, for advice on which way to go here. I still consider myself a newbie in PowerShell so I am wondering is it more acceptable to ask the user to supply these repeating parameters on each call or should I create a “New-Server” type call that returns an object that can be passed to subsequent functions that encapsulates all the repeating values?
Get-ePOWhatever -ComputerName “blah” -Port 5443 -Credential $myCredential -APIPath “remote” -SystemName “Mikes-PC” -Parm1 $value1 -Parm2 $value2
$ePOServer = New-ePOServer -ComputerName “blah” -Port 5443 -Credential $myCredential -APIPath “remote”
Get-ePOWhatever -Server $ePOServer -SystemName “Mikes-PC” -Parm1 $value1 -Parm2 $value2
Also, I would like your opinion on the naming convention. Currently, when specifying the name of the server in the API call I name that parameter -ComputerName. When passing a parameter to specify which computer to perform the API call on, I would name that parameter -SystemName as that is what McAfee refers to it as. (See example above). Would it be more correct when referring to the ePO server to name that parameter -Server and each individual system as -ComputerName?