December 15th, 2012

PowerTip: Use the PowerShell 3.0 Get-CimInstance Cmdlet

Doctor Scripto
Scripter

Summary: Use Windows PowerShell 3.0 to connect to servers running Windows Server 2003 with the Get-CimInstance cmdlet.

Hey, Scripting Guy! Question How can I use Get-CimInstance to connect to servers running Windows Server 2003 in my legacy environment?

Hey, Scripting Guy! Answer Charlotte Windows PowerShell user group member Brian Wilhite says: The new CIM cmdlets use the WSMan protocol by default, which isn’t supported on Windows Server 2003. However, you can use the New-CimSessionOption cmdlet with the Protocol parameter and the New-CimSession cmdlet to create a session for use with Windows Server 2003. Consider the following steps:

1. $SessionOption = New-CimSessionOption -Protocol Dcom

2. $CimSession = New-CimSession -SessionOption $SessionOption -ComputerName WinSrv2003

3. Get-CimInstance Win32_BIOS -CimSession $CimSession

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.