简体   繁体   English

访问被拒绝-Powershell

[英]Access Denied - Powershell

I'm having a bit of a wierd problem. 我有一个奇怪的问题。

At my company we use seperate admin accounts for all AD modification puposes (for eg. if my normal AD ID is User01 then my admin a/c wud be something like User01_adm -> this has the modification rights over ad users / groups). 在我公司,我们为所有AD修改目的使用单独的管理员帐户(例如,如果我的常规AD ID为User01,则我的管理员帐号应该类似于User01_adm->这对广告用户/组具有修改权限)。 Now, i can make changes like say change the login script from ARS web console using my adm a/c but if i use the same in powershell script i get "Access denied" [System.UnauthorizedAccessException]. 现在,我可以使用adm a / c进行更改,例如说从ARS Web控制台更改登录脚本,但是如果在powershell脚本中使用相同的脚本,则会出现“拒绝访问” [System.UnauthorizedAccessException]。 Is there a difference between the way these both are setup (web console & powershell console?) 两者的设置方式(Web控制台和Powershell控制台)之间有区别吗?

I'm using below part for connecting to ARS server with my adm credentials: 我正在使用下面的部分通过我的adm凭据连接到ARS服务器:

 #Connect to ARS server
$GetCreds = Get-Credential -Credential $null
$ConnectARS = Connect-QADService -service $ArsServer -Proxy-Credential $GetCreds

 #make changes
$PopulateData = Set-QADUser -Identity $UserID -Credential $GetCreds -ObjectAttributes @{scriptPath=$LogonScr}

Can any1 pls point wht am i doing wrong? 请问我做错了什么吗?

Any help would be highly appreciated... 任何帮助将不胜感激...

I've nowhere to try it, but shouldn't it be: 我无处可试,但是不应该这样:

#Connect to ARS server
$GetCreds = Get-Credential -Credential $null
$ConnectARS = Connect-QADService -service $ArsServer -Credential $GetCreds

 #make changes
$PopulateData = Set-QADUser -Identity $UserID -Connection $ConnectARS -ObjectAttributes @{scriptPath=$LogonScr}

好的,弄清楚了,它太简单了:它只是Set-QADUser语句中缺少-Proxy开关,现在可以正常工作了,请大家帮忙:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM