Skip to content

Instantly share code, notes, and snippets.

@mattwoolnough
Created July 5, 2020 08:14
Show Gist options
  • Save mattwoolnough/c48fd3fdb072e1facad3311029fdaf71 to your computer and use it in GitHub Desktop.
Save mattwoolnough/c48fd3fdb072e1facad3311029fdaf71 to your computer and use it in GitHub Desktop.
$services = gc .\Documents\services.txt
$stream = [System.IO.StreamWriter] ".\Documents\Registry.xml"
$stream.WriteLine('<?xml version="1.0" encoding="utf-8"?>')
$stream.WriteLine('<RegistrySettings clsid="{A3CCFC41-DFDB-43a5-8D26-0FE8B954DA51}">')
$services | ForEach-Object {
$stream.WriteLine('<Registry clsid="{9CD4B2F4-923D-47f5-A062-E897DD1DAD50}" name="Start" status="Start" image="12" changed="' + (get-date).tostring("yyyy-dd-MM hh:mm:ss") + '" uid="{' + (New-Guid).Guid.ToUpper() + '}"><Properties action="U" displayDecimal="1" default="0" hive="HKEY_LOCAL_MACHINE" key="' + $_ + '" name="Start" type="REG_DWORD" value="00000004"/></Registry>' )
}
$stream.WriteLine('</RegistrySettings>')
$stream.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment