Skip to content

Instantly share code, notes, and snippets.

@y0ug
Created November 11, 2014 15:30
Show Gist options
  • Save y0ug/ceb453ef63de5c681c7a to your computer and use it in GitHub Desktop.
Save y0ug/ceb453ef63de5c681c7a to your computer and use it in GitHub Desktop.
$filename = "service_disabled.txt"
foreach ($line in get-content $filename) {
$line = $line.trim()
if($line.StartsWith("#")){ continue }
$elems = $line.split("#")
$srv = $elems[0].trim()
$desc = $elems[1].trim()
write-host "Disabled:" $srv "|" $desc
set-service $srv -startuptype disabled
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment