invoke command - Powershell passing arguments in ScriptBlock -


i'm trying last write time on file remote server.

this doesn not work:

$server = "myservername"  $lastwrite = invoke-command -computername $server -scriptblock {get-childitem "\\$args[0]\hot.war" } -argumentlist $server | select -property lastwritetime 

this work:

 $lastwrite = invoke-command -computername $server -scriptblock {get-childitem "\\myservername\hot.war" } -argumentlist $server | select -property lastwritetime 

can make first set work?

another way, if using powershell 3. can this:

$lastwrite = invoke-command -computername $server -scriptblock {                get-childitem "\\$using:server\hot.war"              } | select -property lastwritetime 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -