Remote start - Exécution de script powershell
Bonjour a tous
ça fait un moment que je recherche comment faire une exécution d'un script powershell a distance mais sans réussite.
voici ce que j'ai fait
sur un serveur avec powershell 3
Code:
Invoke-Command -ComputerName MachineRemote -ScriptBlock { Start-Process Powershell -ArgumentList "-ExecutionPolicy Bypass -File C:\Path\Script.ps1" }
Dans le script sur la machine "MachineRemote" il y a tout un tas de chose mais là ou ça coince c'est :
Code:
Get-ChildItem \\serveur\d$\dossier -Recurse
pourquoi quand j'exécute le script sur la machine ça fonctionne sans problème et dès que je l’exécute avec "Invoke-Command" depuis un serveur ça ne fonctionne plus ?
le message retour que j'ai depuis le serveur
Code:
1 2 3 4 5 6 7 8 9 10
| [MachineRemote] Connecting to remote server MachineRemote failed with the following error message : A specified logon session does not exist. It may already have been
terminated. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (MachineRemote) [], PSRemotingTransportException
+ FullyQualifiedErrorId : 1312,PSSessionStateBroken
+ PSComputerName : MachineRemote
[MachineRemote] Connecting to remote server MachineRemote failed with the following error message : A specified logon session does not exist. It may already have been
terminated. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (MachineRemote) [], PSRemotingTransportException
+ FullyQualifiedErrorId : 1312,PSSessionStateBroken
+ PSComputerName : MachineRemote |
En vous remerciant d'avance