Forked from CosmosKey/Launch program remotely through CIM over DCOM.ps1
Created
February 28, 2018 15:30
-
-
Save KurtDeGreeff/e0433e075b7bce7f56ac6308c981f673 to your computer and use it in GitHub Desktop.
Launch program remotely through CIM over DCOM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$cimSessionOption = New-CimSessionOption -Protocol Dcom | |
$cimSession = New-CimSession -ComputerName $env:computername -SessionOption $cimSessionOption | |
Invoke-CimMethod -CimSession $cimSession -ClassName win32_process -methodname Create -Arguments @{ | |
commandline = "powershell.exe -executionpolicy bypass -file \\$env:computername\c`$\ps\test.ps1" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment