Hi there -
Using Windows PowerShell commands in Windows Server 2012 for basic administration and networking tasks can save a lot of time. This is true not only because you can script the tasks for application on multiple computers, but you also save time by not having to navigate through sometimes complex user interface (UI) dialog boxes when you use PowerShell to configure individual computers. Following are some PowerShell commands for basic tasks that many IT Administrators perform on a regular basis, and I thought they might help you get started with PowerShell too.
Rename the computer
After you install Windows Server 2012, the computer is assigned an automatically generated name. In most cases, you won't want to keep the random name, you'll want to assign a name for the computer that matches your organization's naming conventions. Instead of navigating through all of the Windows UI to rename and restart the computer, try opening Windows PowerShell and typing the following commands, making sure to replace "ComputerName" with the actual name that you want to use:
Configure a static IP address
Most servers are configured with a static IP address rather than having DHCP client enabled and receiving an IP address dynamically from a DHCP server. You can use the command below to configure the Internet Protocol version 4 (IPv4) properties of a network connection with a static IP address. Before running this command, ensure that you replace the example parameter values with values that are appropriate for your network.
New-NetIPAddress -IPAddress 10.0.0.2 -InterfaceAlias "Ethernet" -DefaultGateway 10.0.0.1 -AddressFamily IPv4 -PrefixLength 24
Configure a network connection with a new DNS server address
If you add a DNS server to your network, you can use the following command to configure IPv4 properties of a statically configured network connection with the IP address of the new DNS server.
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses 10.10.10.1
Join a computer to a domain
To join a computer to a domain, you can run the following command after replacing the domain name with one that's appropriate for your deployment:
Add-Computer -DomainName corp.contoso.com
When you're prompted to do so, type the user name and password for an account that has permission to join a computer to the domain. To restart the computer, use the following command:
Install Active Directory Domain Services (AD DS) and DNS and create a new domain in a new forest
If you have a test environment, you probably recreate it on a frequent basis for new configurations and new tests. Or you might be setting up a new organization domain and network. Either way, the following commands install AD DS and DNS with a new forest, new root domain, and domain name of corp.contoso.com to help you speed-install these roles.
Install-WindowsFeature AD-Domain-Services -IncludeManagementToolsInstall-ADDSForest -DomainName corp.contoso.com
Note that you can install all of the Windows Server 2012 server roles by using the command Install-WindowsFeature, which really streamlines the configuration of servers.
Create a DNS Reverse Lookup Zone
After you install DNS, it's recommended that you create a DNS Reverse Lookup Zone. You can use the following command to configure a reverse lookup zone for a network with the network ID 10.0.0.x:
Add-DnsServerPrimaryZone 0.0.10.in-addr.arpa -ZoneFile 0.0.10.in-addr.arpa.dns
Create a new user account in Active Directory Users and Computers
You can use the following command - after you change the parameter values - to create a new user account in Active Directory. Keep in mind that when you run this command, you'll need to type in the password value at the Windows PowerShell prompt, so this particular method of using this command is not intended for use in scripts.
New-ADUser -SamAccountName User1 -AccountPassword (read-host "Set user password" -assecurestring) -name "User1" -enabled $true -PasswordNeverExpires $true -ChangePasswordAtLogon $false
If you want to assign Active Directory Group membership to the account you just created, you can use this next command. This example assigns group membership to both Enterprise Admins and Domain Admins, so make sure you change these values and the domain name when you use the command, if these are not the memberships and name that you want to assign.
Add-ADPrincipalGroupMembership -Identity "CN=User1,CN=Users,DC=corp,DC=contoso,DC=com" -MemberOf "CN=Enterprise Admins,CN=Users,DC=corp,DC=contoso,DC=com","CN=Domain Admins,CN=Users,DC=corp,DC=contoso,DC=com"
I hope these commands help you configure your network and get started with Windows PowerShell in Windows Server 2012. Also, you can find these commands - and many more - in the Core Network Guide and Companion Guides for Windows Server 2012, which are on the Web at http://technet.microsoft.com/en-us/library/hh882373 .
Thank you, this was helpful.
this is a good ppst some demo you can see on below links http://aikitsupport.com/change-computer-name-using-powershell-windows-server-2012/ http://aikitsupport.com/join-computer-domain-using-powershell-windows-server-2012/
Very Nice So easy Thank You !!!
dear aaslijerDIT WERKT NIE
Willen we MEER powershell??? OF MINDER!??!??!
Nice shortcuts :)
Wow great tutorials.
anymore stuff on cloning VM ?
thanks for ur help
Thanx Nice tutorials
James - What PowerShell combination lets you read, edit, add or delete the Root Hints shown in the GUI?