18 lines
689 B
PowerShell
18 lines
689 B
PowerShell
# script for setting ansible service account to registry key
|
|
$username = "cosmos-ansible"
|
|
$ansible_registry = "HKLM:\SOFTWARE\Cosmos\Ansible"
|
|
$password_key = "Password"
|
|
$password = (Get-ItemProperty $ansible_registry).$password_key
|
|
# This is what the thing needs to set the password
|
|
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force
|
|
# Set password
|
|
$UserAccount = Get-LocalUser -Name $username
|
|
$UserAccount | Set-LocalUser -Password $securePassword
|
|
|
|
# Make it a local admin
|
|
Add-LocalGroupMember -Group "Administrators" -Member $username
|
|
|
|
# Various Ansible Settings
|
|
Set-Item -Path WSMan:\localhost\Service\Auth\Basic -Value $true
|
|
Enable-WSManCredSSP -Role Server -Force
|