我在计算机上写了一个powershell命令,如下所示:
$ path =“ c:\ temp \ WeeklyAccountCheck” if(!(Test-Path $ path)){New-Item -ItemType目录-Force -Path $ path} Get-ADUser-过滤器*-属性* -SearchBase“ OU = CN-NAH-CAPGEMIN,OU = CN,OU = Employees,DC = corp,DC = capgemini,DC = com” |选择对象邮件,员工编号,capgemini-GlobalID,lastlogondate,说明| Export-Csv -path c:\ temp \ WeeklyAccountCheck“ $((Get-Date).ToString(” yyyyMMdd“))_ WeeklyAccoutCheck.csv”
但是当我在另一台计算机上运行Powershell时,出现以下错误:
******** Get-ADUser:术语“ Get-ADUser”未被识别为cmdlet,函数,脚本文件或可运行程序的名称。检查名称的拼写,或者是否输入路径 已包含在内,请验证路径正确,然后重试。 在C:\ Users \ eozhang \ Desktop \ Weekly account check.ps1:3 char:1
+ CategoryInfo : ObjectNotFound: (Get-ADUser:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException********
有人可以帮忙吗?非常感谢。