Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GeorgeTsiokos/251756f5242169d4463c92c653d3d96d to your computer and use it in GitHub Desktop.
Save GeorgeTsiokos/251756f5242169d4463c92c653d3d96d to your computer and use it in GitHub Desktop.
Octopus - Grant Log On As a Service Right (Pre-deployment PowerShell script)
$identity = $OctopusParameters["Octopus.Action.WindowsService.CustomAccountName"]
$nugetExists = Test-Path "$env:TEMP\nuget.exe"
if ($nugetExists -ne $true) {
Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -OutFile "$env:TEMP\nuget.exe"
}
& $env:TEMP\nuget.exe install Carbon -ExcludeVersion -OutputDirectory $env:TEMP
Import-Module $env:TEMP\Carbon\Carbon
Grant-Privilege -Identity $identity -Privilege SeServiceLogonRight
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment