如何通过powershell将计算机加入域 [英] how to join computer to domain through powershell

查看:83
本文介绍了如何通过powershell将计算机加入域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚完成了 Windows 7 Professional 的全新安装,我想通过 powershell 将我的电脑加入域,但是这里出现一些错误是我正在使用的代码

I have just done a fresh installation of windows 7 professional, and I would like to join my pc to domain through powershell but getting some error here is the code which I am using

Add-Computer -ComputerName HMD-PC002 -DomainName mydomain -Credential     
mydomain\Administrator

Add-Computer : Computer 'HMD-PC002' failed to join domain 'mydomain' from its current  
workgroup 'WORKGROUP' with
following error message: Unknown error (0xa8b).
At C:\Users\HMDPC002\Desktop\add-pc_to_Domain.ps1:8 char:1
+ Add-Computer -ComputerName HMD-PC002 -DomainName mydomain -Credential mydomain\A ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : OperationStopped: (HMD-PC002:String) [Add-Computer],   
InvalidOperationException
+ FullyQualifiedErrorId :   
FailToJoinDomainFromWorkgroup,Microsoft.PowerShell.Commands.AddComputerComma

推荐答案

有一个简单的解决方案,我没有配置我的 dns 服务器,我不得不手动更改它,在填充这两个字段后,我运行了以下脚本,它工作

There was an easy solution to this, i didnt configure my dns server i had to change it manually and after populating the two field i ran the following script and it worked

Add-Computer -DomainName mydomain -Credential mydomain\Administrator -Restart

但是我希望 powershell 更改 dns 设置,我会在一个单独的问题中提出这个问题

However i want powershell to change the dns setting i will ask this in a separate question

这篇关于如何通过powershell将计算机加入域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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