I have a low privileged user that administers areas of a corporate Active Directory tree using Powershell. I'd like to test that my script can execute an action rather than calling it and barfing. For example I'd like something that will test:
If(New-ADGroup -GroupScope Global -Path $OU){
New-ADGroup -GroupScope Global -Path $OU -Name $GROUP_NAME
}else{
Write-Host "Ask the administrator to permit"
Write-Host "$env:USERNAME New-ADGroup privs at $OU"
}
Aucun commentaire:
Enregistrer un commentaire