O'Reilly logo

Windows PowerShell™ 3.0 Step by Step by Ed Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running WMI jobs

If DCOM is not an issue and you are using the Get-WMIObject cmdlet to work with remote systems, it is easy to run a remote WMI job. To do this, use the Get-WMIObject cmdlet and specify the -asjob parameter. Once you do this, use the Get-Job cmdlet to check on the status of the job, and use Receive-Job to receive the job results. (For more information about Windows PowerShell remoting and jobs, see Chapter 4.) In the following code, the Get-WMIObject cmdlet retrieves information from the Win32_Bios WMI class from a machine named dc3. The -asjob switched parameter is used to ensure that the command runs as a job. The output is a pswmijob object.

PS C:\Users\administrator.IAMMRED> gwmi win32_bios -ComputerName dc3 -AsJob Id Name ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required