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
Post a Comment