Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

running task on remote machines

$
0
0

I have this code:

 

$uname = (Get-WMIObject -class Win32_ComputerSystem).username

$pcname = read-host "Enter computer name"

$i = Get-WmiObject -Class CCM_Program -Namespace "root\ccm\clientsdk" | Where-Object { $_.Name -like "*Capture USMT Settings z*" }

Invoke-WmiMethod -class CCM_ProgramsManager -Namespace "root\ccm\clientsdk" -Name ExecutePrograms  -argumentlist $i -ComputerName "$pcname" -Credentials "$uname"

 

This will execute a Configuration Manager 2012 task sequence on a remote machine.  It works but only if I am logged onto the remote machine.   I run it from my workstation and if I am also logged onto the target machine it works.  But if you're logged onto the remote machine as a Domain\TestUser it does not run.

 

How come? 


Viewing all articles
Browse latest Browse all 6937

Trending Articles