Question Passage de variable en Remote

Plus d'informations
il y a 14 ans 7 mois #10077 par wildback
Bonjour
j'essaye d'ecrire un petit script qui va lancer un .bat a distance sur une machine comme un process. Mais impossible de passer la variable $InstallClient. Power Shell me retourne l'erreur suivante:

\"Cannot validate argument on parameter 'ScriptBlock'. The argument is null. Supply a non-null argument and try the command again\"

Pourtant je pense que ma commande n'est pas fausse:
[code:1]
$remotePCName = (Get-Content \"C:\toto\ServerList.txt\"«»)
$process = [WMICLASS]\"\\$server\ROOT\CIMV2:win32_process\"
$InstallClient= $process.Create(\"C:\TestFW\bin\installClient.bat\"«»)

invoke-Command -ComputerName $remotePCName -scriptblock {param($InstallClient) invoke-Command $InstallClient }
[/code:1]

et donc cette commande me retourne:

Cannot validate argument on parameter 'ScriptBlock'. The argument is null. Supply a non-null argument and try the command again
.
+ CategoryInfo : InvalidData: (:) [Invoke-Command], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.InvokeCommandCommand


Quelqu'un a une idée ?<br><br>Message édité par: wildback, à: 18/08/11 12:00

Connexion ou Créer un compte pour participer à la conversation.

Temps de génération de la page : 0.030 secondes
Propulsé par Kunena