Hi,
I'd like to implement a group policy for certain accounts where the rights for that users is OS admin of their servers(theirhost) but no interactive login, or No OS Admin rights but be able to run their scripts/apps with admin privilege (their script is a powershell that allows them to create A host records to DNS servers).
Here is the script:
$username = "accountusertocreatednsrecord"
$password = "randompassword"
$theirhost = "10.10.10.5"
Write-Host ""
Write-Host "currently executing script on host: " $pshost
Write-Host "Connecting to remote host/share via credSSP"
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
Invoke-Command -ComputerName $pshost -ScriptBlock { Add-DnsServerResourceRecord -A -IPv4Address 10.10.10.10 -Name testhost01 -ZoneName mydomain.com -ComputerName addns.mydomain.com } -Authentication CredSSP -credential $cred
I have tried delegating the accounts with DNS rights but however its not working. The script only worked when I added the users to local admin group.
Is there a way for these user to execute the script successfully without being admin to their servers?