Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
833 connectés 

  FORUM HardWare.fr
  Programmation
  Shell/Batch

  [Powershell] Commande Enter-PSSession OK, Invoke-Command NOK

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[Powershell] Commande Enter-PSSession OK, Invoke-Command NOK

n°2455995
sebastien4​444
Posté le 16-10-2023 à 11:34:15  profilanswer
 

Bonjour,
 
Je cherche à installer et désinstaller des programmes à distance sur des PCs.
Comme je souhaite rajouter un peu d'automatisme à cette tâche, j'aimerai pouvoir le faire avec Invoke-Command plutôt qu'en me connectant sur la machine avec Enter-PSSession mais ça ne fonctionne pas.
 
Prenons l'exemple de notre agent GLPI ; j'arrive à le désinstaller aussi bien avec Invoke-Command qu'avec Enter-PSSession

Code :
  1. Invoke-Command -computer "Nom-PC" -ScriptBlock {(Get-WmiObject -Class Win32_Product | Where { $_.Name -like "GLPI*"}).Uninstall()}


 
Par contre, pour ma commande d'installation, une fois connecté en PSSession, la commande suivant installe bien l'agent:

Code :
  1. & msiexec.exe '/quiet', '/i', "C:\GLPI\GLPI-Agent-1.4-x64.msi", 'RUNNOW=1', 'SERVER="https://srvglpi.info.net/front/inventory.php"'


 
Mais en faisant comme ça, ça ne fonctionne pas :

Code :
  1. Invoke-Command -computer "Nom_PC" -ScriptBlock {& msiexec.exe '/quiet', '/i', "C:\GLPI\GLPI-Agent-1.4-x64.msi", 'RUNNOW=1', 'SERVER="https://srvglpi.info.net/front/inventory.php"'}


 
Est-ce que vous auriez une idée d'où peut venir ce problème ?

mood
Publicité
Posté le 16-10-2023 à 11:34:15  profilanswer
 

n°2456126
sebastien4​444
Posté le 18-10-2023 à 09:50:22  profilanswer
 

J'ai beau chercher partout je ne trouve rien là dessus.  
Pas d'idée ?


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Shell/Batch

  [Powershell] Commande Enter-PSSession OK, Invoke-Command NOK

 

Sujets relatifs
[Powershell] Résultat RegExp incorrect (bug?)Script powershell programmes au démarrage
[Powershell]Manipuler des données dans une clé de registre[Powershell] Utilisation Variable boucle
Powershell Get-EXOMailboxscript PowerShell sur la copie des favoris Mozilla, Chrome
[powershell] psdrive / Tache Planifiée[powershell] Office365 Authentification morderne
Powershell : Lancement programme + notificationTransformer script Powershell en batch
Plus de sujets relatifs à : [Powershell] Commande Enter-PSSession OK, Invoke-Command NOK


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR