
Exécuter des commandes Windows à distance et capturer la sortie en utilisant uniquement WMI et PowerShell (sans remoting).
Outils d'exécution à distance pour Windows qui reposent uniquement sur WMI et PowerShell.
Exécutez des commandes console à distance et capturez les flux stdout/stderr sans dépendre de PowerShell Remoting, WinRM ou PsExec.
Article de blog et vidéo sur cette technique.
L'exemple ci-dessous vous montre comment WmiExec peut accepter la chaîne de commande comme valeur provenant du pipeline.
PS C:\ "Get-ChildItem C:\" | .\WmiExec.ps1 -ComputerName "server1"
Running the following command on: server1...
Get-ChildItem C:\
PID: 5580 - Waiting for remote command to finish...
PID: 5580 - Waiting for remote command to finish...
Result...
Directory: C:\
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 28.06.2018 15:16 PerfLogs
d-r--- 09.09.2019 15:19 Program Files
d-r--- 07.10.2019 08:36 Program Files (x86)
d-r--- 10.10.2019 10:51 Users
d----- 10.10.2019 16:00 Windows
L'exemple ci-dessous vous montre le type d'objet qui est retourné.
PS C:\ $result = .\WmiExec.ps1 -ComputerName "server1" -Command "Get-ChildItem C:\"
Running the following command on: server1...
Get-ChildItem C:\
PID: 5580 - Waiting for remote command to finish...
PID: 5580 - Waiting for remote command to finish...
Result...
PS C:\ $result.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True String System.Object
Twitter https://twitter.com/OneScripter
Faites encore plus de choses intéressantes comme créer des interfaces web pour vos scripts PowerShell qui exploitent le RBAC, en utilisant System Frontier. https://systemfrontier.com/powershell