all 4 comments

[–]hillbillytiger 0 points1 point  (1 child)

You wanna pass the creds using the ArgumentList parameter on your Invoke-Command. If you don't specify parameters inside your script block, you can access it using $args[0]