Welcome to Powershell

Windows PowerShell is an amazingly powerful tool to help you with common windows administrative tasks. If you are comfortable with one of the myriads of scripting languages available today, Powershell will be easy for you to learn while also providing the benefits of command-line administration. Microsoft is pushing Powershell to the forefront of its management products. You’ll witness this in any new Microsoft product shipping today. Some tasks require Powershell exclusively in order to configure. So not only is Powershell fun and flexible, it is going to be required knowledge moving forward. This collection will help you Install and Configure Windows Servers, Modify an Installation, Configure Server Core, Install Active Directory Domain Controllers, Automate Active Directory User Accounts, Control Groups, Group Policy, Hyper-V, and Configure Local Storage. This is a great skill to have for Microsoft System Administrators.

First, get some help

Get-Help

What better place to start than with the command that will show how to get help with the commands. Get-Help can be used with any command. Maybe you’re curious how the Add-Computer command works. Simply type Get-Help -Name Add-Computer into Powershell, hit enter, and be rewarded with command details such as Name, Synopsis, Syntax, Description, Related Links, and Remarks.

Now that you know how to get help, let’s dig into the nitty-gritty. Powershell commands follow the syntax of Verb – Noun which is known as a cmdlet or command let.

Add a Feature

Install -WindowsFeature You can deploy a feature to remote computer using the –computer flag, as in: Install -WindowsFeature -Computer

Add Migration Tools

Install -WindowsFeature Migration

Switch from Full to Core

Uninstall-WindowsFeature Server-Gui-Mgmt-Infra, Server-Gui-Shell –Restart (Also using –Remove actually removes the underlying binaries)

Switch from Core to Full

Install-WindowsFeature Server-Gui-Mgmt-Infra,Server-Gui-Shell –Restart

Switch from Full to Core Using DISM (not actually PowerShell)

Dism /online /disable-feature /featurename:ServerCore-FullServer

Install Minimal Server Interface from Core

Install-WindowsFeature Server-Gui-Mgmt-Infra

Install Minimal Server Interface from Full

Uninstall-WindowsFeature Server-Gui-Shell (Note: you can add the –WhatIf flag to see other dependent components that might also be uninstalled)

Features on Demand

Simply use Unintall-Windows Feature and include the -Remove flag to remove the binaries. To perform this on a remote computer, include -Computer

Configure IP Address

New-NetIPAddress -IPAddress 10.10.10.73 -InterfaceAlias "Ethernet" -DefaultGateway 10.10.10.1 -PrefixLength 24

Configure DNS address

Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses 10.10.10.70, 10.10.10.1

Join Computer to Domain

Add-Computer -DomainName vegibit.com

Installing Active Directory Binaries

Install-WindowsFeature –name AD-Domain-Services

Installing New Forest

Install-ADDSForest

Installing New Domain

Install-ADDSDomain

Installing Additional Domain Controller

Install-ADDSDomainController

Uninstall Active Directory Binaries

Uninstall-WindowsFeature –name AD-Domain-Services

Uninstall Domain Controller

1 Uninstall - ADDSDomainController Enable Active Directory Recycle Bin Enable - ADOptionalFeature – Identity ‘ CN = Recycle Bin Feature , CN = Optional Features , CN = Directory Service , CN = Windows NT , CN = Services , CN = Configuration , DC = vegibit , DC = com ’ – Scope ForestOrConfigurationSet – Target ‘ vegibit . com ’

Create new users

New-ADUser

Create Groups

1 New - ADGroup - Name bostonAdmins - SamAccountName bostonAdmins - GroupCategory Security - GroupScope Global - DisplayName bostonAdmins - Path "OU=User Accounts,ou=boston Admins,ou=boston,ou=Massachusetts,dc=vegibit,dc=com" - Description "boston Administrators"

Add Members to Group

add-adgroupmember bostonAdmins bostonAdmin01,bostonAdmin02

Advertise IPv6 on interface

set-NetIPInterface -InterfaceAlias "Ethernet 2" -AddressFamily IPv6 -Advertising Enabled

Configure Network Route for ISATAP Interface

New-NetRoute -InterfaceIndex 13 -DestinationPrefix 2001:ABCD:/64 -Publish Yes

Enable Resource Metering for Hyper-V

Get-VM -Computername | Enable-VMResourceMetering

View Resource Metering for a Specific Guest

Get -VM -ComputerName -Name | Measure -VM

Change Measurement Interval (default 1:00)

Set -vmhost –computername – ResourceMetering SaveInterval HH :MM :SS

Obtain all VMS Metering Data

Get -VM -ComputerName | Measure -VM

Obtain Specific Guest Metering Data

Get -VM -ComputerName -Name | Measure -VM

Show Storage Pools

Get -StoragePool

Show Virtual Disks

Get -VirtualDisk Repair Virtual Disk Repair -VirtualDisk

Show Unhealthy Physical Disks

Get -PhysicalDisk | Where{$_.HealthStatus –ne “Healthy”}

Remove Physical Disk from Storage Pool

Reset -PhysicalDisk

List Physical Disks Used for Virtual Disks

Get -VirtualDisk | Get -PhysicalDisk

Add a Physical Disk to Storage Pool

Add -PhysicalDisk

Thank you for reading Install and Configure Windows Server 2012 with Windows Powershell – If you found this post helpful, Please do share using the buttons below!