How Complex Can You Get With Invoke-Command


i know can call whole script , great. working on function earlier , @ end use local variable call invoke-command pass in alternative credentials remote computer , try use win32_product's install method install programs. local variables going install method (file, switch , believe). can post code bugging me.

this doing don't have access script right now:

 

 

$installer = new-object system.management.managementclass("win32_product")  $creds = get-credentials  $file = "c:\users\rowdy\desktop\setup.msi"  $switch= ""  $everyone = $true    invoke-command -computername . -credentials $creds -scriptblock {param($arg1, $arg2, $arg3) {$installer.install($arg1, $arg2, $arg3 )} -argumentlist $file, $switch, $everyone   

 

hi,

you have couple bugs in code, try that:

$creds = get-credential  $file = "c:\users\mg\desktop\ext4.msi"  $switch= ""  $everyone = $true    invoke-command -computername . -credential $creds -scriptblock {  param($arg1, $arg2, $arg3)   $installer = new-object system.management.managementclass("win32_product")  $installer.install($arg1, $arg2, $arg3 )  } -argumentlist $file, $switch, $everyone 


 



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Group Policy Event ID 1058 Error Code 1326 (The user name or password is incorrect)

Suspicious event log Event ID: 4905

DCOM received error "2147746132" from...