Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save CosmosKey/6cf3dc7ce51cbb1c1873d718a98e7410 to your computer and use it in GitHub Desktop.
Save CosmosKey/6cf3dc7ce51cbb1c1873d718a98e7410 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