Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $serviceName = "SamsService"
- $exePath = "c:servicesservice.exe"
- $userName = "mydomainserviceuser"
- $securePassword = convertto-securestring -String "1a_really_$trong_password1" -AsPlainText -Force
- $credentialsObject = new-object -typename System.Management.Automation.PSCredential -argumentlist $userName, $securePassword
- New-Service -BinaryPathName $exePath -Name $serviceName -Credential $credentialsObject -DisplayName $serviceName -StartupType Manual
Add Comment
Please, Sign In to add comment