List unquoted service paths and start, stop, or restart services as needed.
Some services require administrative privileges.
Tested with PowerShell v5.1.18362.752 on Windows 10 Enterprise OS (64-bit).
Made for educational purposes. I hope it will help!
Open the PowerShell from \src\ and run the commands shown below.
Set the execution policy:
Set-ExecutionPolicy Unrestricted
Run the script:
.\unquoted_service_paths.ps1
Or, run the following command from either PowerShell or Command Prompt:
PowerShell -ExecutionPolicy Unrestricted -File .\unquoted_service_paths.ps1
To run the PowerShell encoded command, run the following command from either PowerShell or Command Prompt (minified script):
PowerShell -ExecutionPolicy Unrestricted -EncodedCommand JABzAHMAIAA9ACAAJABuAHUAbABsADsAIAAkAGkAIAA9ACAAJABuAHUAbABsADsAIAB0AHIAeQAgAHsAIABXAHIAaQB0AGUALQBIAG8AcwB0ACAAIgBGAGUAdABjAGgAaQBuAGcAIAB0AGgAZQAgAGwAaQBzAHQAIABvAGYAIABzAGUAcgB2AGkAYwBlAHMALAAgAHQAaABpAHMAIABtAGEAeQAgAHQAYQBrAGUAIABhACAAdwBoAGkAbABlAC4ALgAuACIAOwAgACQAcwBzACAAPQAgAEcAZQB0AC0AVwBtAGkATwBiAGoAZQBjAHQAIAAtAEMAbABhAHMAcwAgAFcAaQBuADMAMgBfAFMAZQByAHYAaQBjAGUAIAB8ACAAVwBoAGUAcgBlAC0ATwBiAGoAZQBjAHQAIAB7ACAAJABfAC4AUABhAHQAaABOAGEAbQBlACAALQBpAG4AbwB0AG0AYQB0AGMAaAAgACIAYAAiACIAIAAtAGEAbgBkACAAJABfAC4AUABhAHQAaABOAGEAbQBlACAALQBpAG4AbwB0AG0AYQB0AGMAaAAgACIAOgBcAFwAVwBpAG4AZABvAHcAcwBcAFwAIgAgAC0AYQBuAGQAIAAoACQAXwAuAFMAdABhAHIAdABNAG8AZABlACAALQBlAHEAIAAiAEEAdQB0AG8AIgAgAC0AbwByACAAJABfAC4AUwB0AGEAcgB0AE0AbwBkAGUAIAAtAGUAcQAgACIATQBhAG4AdQBhAGwAIgApACAALQBhAG4AZ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ACAAaQBmACAAKAAkAGkAIAAtAG4AZQAgACQAbgB1AGwAbAApACAAewAgACQAaQAuAEMAbABvAHMAZQAoACkAOwAgACQAaQAuAEQAaQBzAHAAbwBzAGUAKAApADsAIAB9ACAAfQANAAoA
To generate a PowerShell encoded command from a PowerShell script, run the following PowerShell command:
[Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes([IO.File]::ReadAllText($script)))
To decode a PowerShell encoded command, run the following PowerShell command:
[Text.Encoding]::Unicode.GetString([Convert]::FromBase64String($command))
Figure 1 - Unquoted Service Paths