Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save KurtDeGreeff/e0433e075b7bce7f56ac6308c981f673 to your computer and use it in GitHub Desktop.
Save KurtDeGreeff/e0433e075b7bce7f56ac6308c981f673 to your computer and use it in GitHub Desktop.
Launch program remotely through CIM over DCOM
$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