我有一个Powershell脚本,它检查CSV文件,并基于CSV中的数据创建AD中的用户。 我已经声明路径为
$UPN = $user.Fname.Substring(0,1) + "." + $user.Lname
$OU = "xyz-users,DC=contoso,DC=com"
$usremailad=$user.Fname.substring(0,1) + "." +$user.Lname +"$dnsroot"
Try {
if (!(get-aduser -Filter {samaccountname -eq "$SAM"})){
$Parameters = @{
'SamAccountName' = $Sam
'UserPrincipalName' = $UPN
'Name' = $Fullname
'Path' = $OU
'GivenName' = $Fname
'Surname' = $Lname
}
执行代码时,出现以下错误:
无法处理参数,因为参数“ path”的值不是 有效。更改“ path”参数的值并运行操作 再次。
我知道这很简单,但现在还不知道。 相同的脚本可以100%正常工作。不知道发生了什么变化。 The error