Okay, I'm able to run the command on the remote machine and pipe the output
to the a text file and access via \\<machine>\c$\file.txt
My problem is the WMI command executes and moves on to the next command
before the text file is actually done being written, so the following command
that parses that file errors out because the data is still processing.
I found some code but not sure if i can use it for my particular
application, here is some sample code i found using .net
PS C:\Users\Administrator> $tpid =
Is it possible to use this to pause the script until the WMI command
finishes completely on the remote machine?
> Hi All,
> I'm trying to send a command line to a remote machine using WMI and saving
> the out to a text file on the remote machine so i can pull that file back to
> parse. The following is just a test script and it works but it will not
> output to a text file. I know it works because i send a different command to
> stop a vmware image.
> $command = "dir c:\ > c:\output.txt"
> $computer = "172.16.98.185"
> $ProcessClass = get-wmiobject -query "SELECT * FROM Meta_Class WHERE
> __Class = 'Win32_Process'" -namespace "root\cimv2" -computername $computer
> $results = $ProcessClass.Create($command)
> $results | format-list *
> Any help or advice would be appreciated.