
Esegui comandi Windows da remoto e cattura l'output utilizzando solo WMI e PowerShell (non il remoting).
Strumenti di esecuzione remota per Windows che si basano esclusivamente su WMI e PowerShell.
Esegui comandi console in remoto e cattura i flussi stdout/stderr senza affidarti a PowerShell Remoting, WinRM o PsExec.
Post sul blog e video su questa tecnica.
L'esempio seguente mostra come WmiExec può accettare la stringa di comando come valore dalla 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'esempio seguente mostra il tipo di oggetto restituito.
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
Fai cose ancora più interessanti, come creare interfacce web GUI per i tuoi script PowerShell che sfruttano RBAC, usando System Frontier. https://systemfrontier.com/powershell