【发布时间】:2020-03-06 19:10:45
【问题描述】:
我无法创建新的 ADOrganizationalUnits 和 ADGroups。它需要在 Powershell 中完成,但由于某种原因我只是没有掌握这个概念。这是我的代码:
我已经查看了文档,但仍然无法弄清楚。
# Script to create New AD Org. Units
#Author : Phil Bauer
Import-Module ActiveDirectory
$oupath = "OU=Business,DC=PhilB,DC=local"
$oupathIT = "OU=IT,OU=Business,DC=PhilB,DC=local"
$oupathSales = "OU=Sales,OU=Business,DC=PhilB,DC=local"
$oupathDesign = "OU=Design,OU=Business,DC=PhilB,DC=local"
$oupathMark = "OU=Marketing,OU=Business,DC=PhilB,DC=local"
$oupathProd = "OU=Production,OU=Business,DC=PhilB,DC=local"
New-ADGroup -Name: "HelpDesk" -DisplayName: "Help Desk" -path: "OU=Business , DC=PhilB , DC=local"
New-ADOrganizationalUnit -Name: "Sales" -path: $oupath
New-ADOrganizationalUnit -Name: "Design" -path: $oupath
New-ADOrganizationalUnit -Name: "Marketing" -path: $oupath
New-ADOrganizationalUnit -Name: "Production" -path: $oupath
New-ADOrganizationalUnit -Name: "IT" -path: $oupath
New-ADGroup -Name: "SalesIT" -DisplayName: "Sales IT" -GroupCategory: "Security" -GroupScope: "Global" -path: $oupathIT -
New-ADGroup -Name: "DisplayIT" -DisplayName: "Design IT" -GroupCategory: "Security" -GroupScope: "Global" -path: $oupathIT
New-ADGroup -Name: "MkgtIT" -DisplayName: "Marketing IT" -GroupCategory: "Security" -GroupScope: "Global" -path: $oupathIT
New-ADGroup -Name: "DsgnIT" -DisplayName: "Production IT" -GroupCategory: "Security" -GroupScope: "Global" -path: $oupathIT
New-ADGroup -Name: "SalesMgr" -DisplayName: "Sales Manager" -GroupCategory: "Security" -GroupScope: "Global" -path: $oupathSales
New-ADGroup -Name: "SalesField"-DisplayName: "Field Sales" -GroupCategory: "Security" -GroupScope: "Global" -path: $oupathSales
New-ADGroup -Name: "DsgnMgr" -DisplayName: "Design Manager " -GroupCategory: "Security" -GroupScope: "Global" -path: $oupathDesign
New-ADGroup -Name: "Dsgn" -DisplayName: "Designers" -GroupCategory: "Security" -GroupScope: "Global" -path $oupathDesign
New-ADGroup -Name:"MktHead" -DisplayName: "Lead Marketer" -GroupCategory: "Security" -GroupScope: "Global" -path $oupathMark
New-ADGroup -Name: "MktJr" -DisplayName: "Marketing Juniors" -GroupCategory: "Security" -GroupScope: "Global" -path $oupathMark
New-ADGroup -Name: "ProdMgr" -DisplayName: "Production Manager" -GroupCategory: "Security" -GroupScope: "Global" -path $oupathProd
New-ADGroup -Name: "ProdTeam" -DisplayName: "Production Team" -GroupCategory: "Security" -GroupScope: "Global" -path $oupathProd
我得到的错误信息是这样的:
New-ADOrganizationalUnit : The server is unwilling to process the request
At line:13 char:1
+ New-ADOrganizationalUnit -Name: "Sales" -path: $oupath
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (OU=Sales,OU=Business,DC=PhilB,DC=local:String) [New-ADOrganizationalUnit]
, ADException
+ FullyQualifiedErrorId : ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.NewADOrganizationa
lUnit
【问题讨论】:
标签: powershell active-directory powershell-2.0