Powershell - Admin credentials

Powershell - Admin credentials

Read-Host "Enter Password" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File "\\DomainName\netlogon\cred.txt"

Add these next lines to the beginning of scripts

$pass = get-content "\\DomainName\netlogon\creds.txt" | ConvertTo-SecureString $credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist "DomainName\administrator",$pass