WMI remoting.

Q: What IT Pro does if he has too much work and too little time to do something interesting?

A: He does something interesting that will save him some time doing his work. 😉

Two good examples of that today. First – we were asked by user to help him with installing citrix stuff for remote app. We could use OCS, VNC or other technique but hey, why not use PowerShell for that? I’ve read about Invoke-WMIMethod a while ago but never tried to use it. So I tried today, twice. First it was msi package to be installed: so we used Win32_Product:

PowerShell, using GeSHi 1.0.8.8

InvokeWmiMethod -ComputerName MyInvocation -Class Win32_Product -Name Install -ArgumentList @($true, $null, ‘c:tempPowerGUI.msi’)

Of course line used was different (PC, package) but worked as smooth as new PowerGUI. 😉

Next thing we tried was to install soft we needed on another remote machine. But because it reboots the machine once installed we have tested it on machine standing on our desk, just to see if it works. And because it’s .exe installation we used Win32_Process this time:

PowerShell, using GeSHi 1.0.8.8

InvokeWmiMethod -ComputerName MyInvocation -Class Win32_Process -Name Create -ArgumentList @(‘c:windowsnotepad2.exe’)

OK, but one thing I could not find: description of methods in PowerShell directly. Fortunately I had WMIExplorer that helped me get proper syntax, especially for Win32_Product – this method’s call is not intuitive at all…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s