PowerShell Team

PowerShell Team

WINRM is the CLI interface to our WS-MGMT protocol. The neat thing about this is that you can call it from PowerShell to manage remote systems that don’t have PowerShell installed on them (including Server Core systems and Raw hardware). I was trying some things out and encountered the following error:

PS> winrm
C:\Windows\System32\winrm.vbs(1034, 1) Microsoft VBScript runtime error: ActiveX component can’t create object: ‘WSMAN.InternalAutomation’

This is the second time that I’ve done something that made this problem come up. I’m working on a system that changes constantly so it is probably some side effect of something you’ll never encounter. That said, I’ve run into it twice so I thought I would share the fix. This also documents the fix so if it happens to me again, I’ll just use LiveSearch to find the solution J.

Run a PowerShell session with Admin Privs (I’m doing this on Vista):

PS> cd ${env:windir}/system32
PS> Regsvr32 WsmAuto.dll
PS> Regsvr32 WSManMigrationPlugin.dll

Do that and Bob’s your Uncle.

BTW – you can do cool stuff with WINRM from PowerShell if you remember 2 things:

  1. You have to quote native code command switches that use “:”s
  2. You can cast XML to [XML] and then party

PS> winrm e wmi/root/cimv2/win32_service
AcceptPause = false
AcceptStop = true
Caption = Application Experience
CheckPoint = 0
CreationClassName = Win32_Service
Description = Processes application compatibility cache requests for applications as
they are launched
DesktopInteract = false
DisplayName = Application Experience
ErrorControl = Normal
ExitCode = 0
InstallDate = null
Name = AeLookupSvc
PathName = C:\Windows\system32\svchost.exe -k netsvcs
ProcessId = 1108
ServiceSpecificExitCode = 0
ServiceType = Share Process
Started = true
StartMode = Auto
StartName = localSystem
State = Running
Status = OK
SystemCreationClassName = Win32_ComputerSystem
SystemName = JPSLAP11
TagId = 0
WaitHint = 0
# Apparently the WINRM folks think XML is “Pretty”
PS> winrm e wmi/root/cimv2/win32_service “-format:pretty”
<wsman:Results xmlns:wsman=””>
<p:Win32_Service xsi:type=”p:Win32_Service_Type” xmlns:xsi=”
ema-instance” xmlns:p=”
vice” xmlns:cim=””>
<p:Caption>Application Experience</p:Caption>
<p:Description>Processes application compatibility cache requests for applications as
they are launched</p:Description>
<p:DisplayName>Application Experience</p:DisplayName>
<p:InstallDate xsi:nil=”true”></p:InstallDate>
<p:PathName>C:\Windows\system32\svchost.exe -k netsvcs</p:PathName>
$x=[xml](winrm e wmi/root/cimv2/win32_service “-format:pretty”)


PS> $x.results

wsman Win32_Service
—– ————-… {AeLookupSvc, ALG, Appinfo, AppMgm…

PS> $x.results.Win32_service |sort State,Name |ft -group State name,Caption

State: Running

Name Caption
—- ——-
AeLookupSvc Application Experience
Appinfo Application Information
AppMgmt Application Management
ASFIPmon Broadcom ASF IP and SMBIOS Mailbox Monitor

State: Stopped

Name Caption
—- ——-
ALG Application Layer Gateway Service
aspnet_state ASP.NET State Service
clr_optimization_v2.0.50727_32 Microsoft .NET Framework NGEN v2.0…



Jeffrey Snover [MSFT]
Windows Management Partner Architect
Visit the Windows PowerShell Team blog at:
Visit the Windows PowerShell ScriptCenter at:

PowerShell Team
PowerShell Team

Follow PowerShell Team   

No Comments.