Skip to content

Instantly share code, notes, and snippets.

@lansalot
Created May 20, 2021 08:00
Show Gist options
  • Save lansalot/3001c6737e534e5075e7e4ba844fd48e to your computer and use it in GitHub Desktop.
Save lansalot/3001c6737e534e5075e7e4ba844fd48e to your computer and use it in GitHub Desktop.
$servers = import-csv .\unquotedservers.txt -Delimiter "!" # what was I doing here? meh...
ForEach ($Server in $Servers) {
Write-Progress "Checking $($Server.Server) and `"$($server.servicename)`""
$st = sc.exe \\$($server.Server) qc "$($server.servicename)" | select-string BINARY_PATH
$exe = $st.line.substring($st.line.indexof(":") + 2 ,$st.line.indexof(".exe") - $st.line.indexof(":") + 2)
$st
$fixed = "`"`\`"$exe\`"`""
"sc.exe \\$($server.server) config `"$($server.servicename)`" binpath= $fixed"
""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment