Trying to run advertised programs from powershell
the problem i'm having based on discussion in same forum called "possible run advertised programs powershell". outlines how can retrieve package id , name , run via powershell. command this: $uiresource.executeprogram($sr1000f, $sr1:all patches,$true). 2 errors - missing ')' in method call , unexpected token 'patches' in expression. think issue might space between , patches. i've tried various ' , " , () in expression can't seem find 1 works. appreciated.
i figured out issue was; should have been $uiresource.executeprogram('*', '$sr1000f',$true). works fine on local computer access denied on remote computer. went different direction , had success. first needed run "enable-psremoting" on local , remote computer. able use following script got https://smsagent.wordpress.com/tag/powershell-task-sequence/. kicks off fine.
$computername = read-host 'computer name' $s = new-pssession -computername $computername invoke-command -session $s -scriptblock ` { $tsid = "sr1000f" get-wmiobject -namespace "root\ccm\scheduler" -class ccm_scheduler_history | {$_.scheduleid -like "*$tsid*"} | ft scheduleid get-wmiobject -namespace "root\ccm\scheduler" -class ccm_scheduler_history | {$_.scheduleid -like "*$tsid*"} | remove-wmiobject get-wmiobject -namespace "root\ccm\scheduler" -class ccm_scheduler_history | {$_.scheduleid -like "*$tsid*"} | ft scheduleid get-service | {$_.name -eq "ccmexec"} | restart-service } remove-pssession $s
Windows Server > Windows PowerShell
Comments
Post a Comment