Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Computer to a join a domain through powershell

Posted on 2010-11-23
6
Medium Priority
?
801 Views
Last Modified: 2012-06-21
Hi guys, Im wondering if you gurus could kindly help out with the following.
We would like to have a computer join our domain to the following OU in our domain:

As this will be part of a build process, the computer name should be a variable

OU=Sales,DC=companyA,DC=Com

Is there a way to write:

1.Display on the screen if this had been successful, and
2. to a log file the result to see whether this had been successful

Any help greatly appreciated.
0
Comment
Question by:Simon336697
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 27

Accepted Solution

by:
KenMcF earned 2000 total points
ID: 34206625
If you are using powershell v2 you can use the add-computer cmdlet

Add-Computer -domainname Domain02 -OUPath "OU=testOU,DC=domain,DC=Domain,DC=com"

or

C:\PS>Add-Computer -domainname Domain02 -cred Domain02\Admin02 -passthru

Description
-----------
This command adds the local computer to the Domain02 domain by using the credentials of a domain administrator. The command uses the PassThru parameter to generate a brief report about the results of the command.


http://technet.microsoft.com/en-us/library/dd347556.aspx

To rename the computer you can use the function that Michael B Smith posted on his blog.

http://theessentialexchange.com/blogs/michael/archive/2008/02/04/Rename-Reboot-with-Powershell.aspx
0
 
LVL 1

Author Comment

by:Simon336697
ID: 34210135
Hi Ken, thanks so much for this.

We are tyring to create a build image for Windows 7.

Id like to slowly replace our existing vbs scripts with powershell, but dont know how to activate usage of powershell in a winpe environment. Is this possible to do?
0
 
LVL 27

Expert Comment

by:KenMcF
ID: 34210168
The .Net framework is not directly supported in the WinPE env. Take a look at this link.

http://social.technet.microsoft.com/Forums/en/w7itproinstall/thread/61a7b6e9-2190-4672-bac5-cb6a0bb52b7e
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:Simon336697
ID: 34210187
Hi KenMcF,
Ken, silly question possibly, but how does something like MDT from Microsoft then use powershell in a winpe environment?
0
 
LVL 27

Expert Comment

by:KenMcF
ID: 34210228
Sorry, you are correct. The link I posted before was before MDT2010 was released. With that release you are able to run powershell.
0
 
LVL 1

Author Comment

by:Simon336697
ID: 34228434
Thanks so much Ken really appreciate it.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question