Hi Luc,
can you breifelydescribe whats the difference between
get-wmiobjectand get-ciminstance .
do both of them accpet same classname parameters ?
Something like this
Get-CimInstance -CimSession $session -ClassName Win32_Service
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
No, the class names largely correspond, the way they are called is different.
In short, the CIM classes are the base classes defined by the Common Information Model.
The WMI classes are how MSFT implemented CIM classes.
You can find a good comparison of both in Should I use CIM or WMI with Windows PowerShell?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks Luc,
As per comparision document CIM is preffered approach .
i checked one of the features for remoting uisng cim and i was expecting my prompt changes to remote server (the way enter-pssession works)as following output seems to suggest iam connected to remote server. but prompt remains on local computer.
No, that will not change your prompt.
You save the object returned from the New-CimSession call in a variable.
On each subsequent call to a Cim cmdlet, you pass that object via the CimSession parameter.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thnaksLuc ,
i am trying to get some basic information on remote computer using this command .
i have saved session in $cimobj
iam trying to find what services are running on remote computer .
is this the right way of using cimcomand ??
get-cimclass -ClassName Win32_Service -CimSession $cimobj
Something like this
Get-CimInstance -CimSession $session -ClassName Win32_Service
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thnaksLuc .it works .j
ust thought of asking if all three below works on wsman protocol only and winrm service should be running at remote host.
enter-pssession
Get-CimInstance -CimSession $session -ClassName Win32_Service
and
invoke-command
In PS v6 you can also set up remoting over SSH.
See for example SETUP POWERSHELL SSH REMOTING IN POWERSHELL 6
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
tx i am checking this.