Getting a return value from a scriptblock from invoke-Command
i running following commands:
$rsession = new-pssession -computername $computername -credential $creds
invoke-command -session $rsession -scriptblock { add-computer -domainname $args[0] -credential $args[1] } -verbose -erroraction stop -argumentlist $domain,$creds
how return value add-computer can figure out whether machine joined domain ?
thank you.
you try adding -passthru parameter add-computer command.
Windows Server > Windows PowerShell
Comments
Post a Comment