Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

How to pass a variable through Invoke-Command? $Args?

$
0
0

Howdy,

I've done some searching and found some things about the $args variable, but haven't found something that explains how it works.

I'm simply running these commands:

$AppPool = "defaultpool"

invoke-command -computername Server1 -scriptblock {Import-Module WebAdministration;Restart-WebAppPool $AppPool}

This doesn't work.  I know (or think I know) I need to put $args[0] in there where $AppPool is, but then how do I define what $args is?  Do I also add -arguementlist $apppool in there somewhere?

Thanks!


Viewing all articles
Browse latest Browse all 21975

Trending Articles