您好我刚刚开始在我的服务器上使用powershell。虽然当我运行脚本时出现错误:
New-ADUser : Unable to find a default server with Active Directory Web Services running.
At C:\Users\Administrator\Desktop\Powerwhell Script, H1 case.ps1:6 char:1
+ New-ADUser -name $_."fornavn"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [New-ADUser], ADServerDownException
+ FullyQualifiedErrorId : ActiveDirectoryServer:1355,Microsoft.ActiveDirectory.Management.Commands.NewADUser
我已附加脚本和我的.csv文件。希望你们中的任何人都可以帮助我搞清楚。
(不要担心信息,这是学校的任务)
答案 0 :(得分:0)
您的脚本看起来无法在您的域中找到域控件。只需使用New-ADUser -Server "ServerName.Domain.com"
参数,并为其提供域控制的完全限定域名或IP。
Active Directory Management Gateway Service
如果这不起作用,您可能没有在域控件(Download Here)上安装Import-Csv
。使用Windows Server 2012 R2,请确保已安装以下功能。
警告您看到的标题是因为H1
由于某种原因无法从您的CSV文件中获取标题,并将标题名称替换为H2
,Hx
... fornavn efternavn H1 beskrivelse, ...
------- --------- ----- -----------
Keld Bruun KB Adm.Ledergruppe, ...
。例如:
Import-Csv
您可以通过-Header
参数获取CSV
列的名称。请注意,这些不必与CSV
中的相同,因为新的列标题将覆盖Import-Csv "C:\H1, Powershell.csv" -Header 'fornavn','efternavn','forkortelse','beskrivelse','email','brugernavn','kode','kontor','fuldnavn'
。
[root@green vagrant]# sudo systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
Active: failed (Result: exit-code) since Wed 2016-10-12 10:28:45 CDT; 21h ago
Main PID: 3757 (code=exited, status=1/FAILURE)
CGroup: /system.slice/httpd.service
Oct 12 10:28:45 green.northamerica.cerner.net httpd[3757]: AH00534: httpd: Configuration error: No MPM loaded.
Oct 12 10:28:45 green.northamerica.cerner.net systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Oct 12 10:28:45 green.northamerica.cerner.net systemd[1]: Failed to start The Apache HTTP Server.
Oct 12 10:28:45 green.northamerica.cerner.net systemd[1]: Unit httpd.service entered failed state.
Oct 12 10:53:43 green.northamerica.cerner.net systemd[1]: Unit httpd.service cannot be reloaded because it is inactive.
Oct 12 10:53:59 green.northamerica.cerner.net systemd[1]: Unit httpd.service cannot be reloaded because it is inactive.
Oct 13 08:14:50 green.northamerica.cerner.net systemd[1]: Unit httpd.service cannot be reloaded because it is inactive.