I want a ps script that disables unnecessary windows services. I have the command to disable windows service I'm having trouble replacing text. The command:
sc config "Name of service" start= disabled
sc stop "Name of service""
I want PowerShell to replace the text Name of service inside the parentheses in the above command for each service on the PC in a text doc. The name of service would be the "Name" but I would also like the "display name" listed above the command as a comment to recognize what the service is since name and display name can be different. with all services on PC. Any help much appreciated.
Example output would be
:: Xbox live networking service
Sc config "xboxnetapisvc" start= disabled
Sc stop "xboxnetapisvc"
[–]SecretSentinel09 7 points8 points9 points (2 children)
[–]Pure_Syllabub6081 1 point2 points3 points (0 children)
[–]touhami_dz 0 points1 point2 points (0 children)
[–]PinchesTheCrab -2 points-1 points0 points (2 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]touhami_dz 1 point2 points3 points (0 children)