没有足够的访问权限来执行操作 - 的Powershell [英] Insufficient access rights to perform the operation -- Powershell

查看:2096
本文介绍了没有足够的访问权限来执行操作 - 的Powershell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个简单的脚本来从一个用户复制AD组成员到另一个。我做它使用的ActiveDirectory模块只。

I am writing a simple script to copy AD group membership from one user to the other. I am doing it using the ActiveDirectory module only.

该脚本看起来像它会工作,并没有工作,直到我尝试的广告组给用户。

The script looks like it would work and does work up until I try to ad the groups to the user.

code:

import-module ActiveDirectory
$templateUser = get-ADUser user1
$targetUser = getADUser user2

$groups =get-adprincipalgroupmembership $templateUser
$groups2 = get-ADPrincipalGroupMembership $targetUser

foreach($group in $groups) {
    add-adGroupMember $group $targetUser
}

错误:

Add-ADGroupMember : insufficient access rights to performt the operation
At line:9 char:18
+ FullyQualifiedErrorID : Insufficient access rights to perform the operation,Microsoft.ActiveDirectory.Management.Commands.AddADGroupMember

注/思考:

我登录作为一个普通用户,但我跑了PowerShell的为不同的用户(我的管理员帐户)。我不是本地管理员,但我的域管理员。我能够将用户添加到组,如果我启动AD工具和手工做的(我有权限添加到这些组)。

I am logged in as a normal user, but I ran the powershell as a different user (my admin account). I am not a local admin, but I am an admin on the domain. I am able to add the user to groups if I launch the AD Tools and do it manually (I have permissions to add to those groups).

编辑:

运行PowerShell中的管理。

Run the powershell as admin.

推荐答案

运行PowerShell中以管理员身份。

Run powershell as administrator.

这篇关于没有足够的访问权限来执行操作 - 的Powershell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆