Showing posts with label Windows Server 2012 R2 and Powershell TTutorials. Show all posts
Showing posts with label Windows Server 2012 R2 and Powershell TTutorials. Show all posts

Friday, June 26, 2015

Managing Windows Server 2012 R2 Using PowerShell : Part-9 : Installing Windows Features.

 

  1. Part 1 : Windows Server 2012 R2 Installation.
  2. Part 2 : Exploring PowerShell Default Settings.
  3. Part 3 : Getting and setting server name.
  4. Part 4 : Getting IP Address of the server.
  5. Part 5 : Setting IP Address of the server.
  6. Part 6 : Checking if Server is member of domain.
  7. Part 7 : Joining Server to the domain.
  8. Part 8 : Magic of PowerShell PSRemoting..

6-24-2015 12-42-00 PM

Part - 9 : Installing Windows Features.

In the previous post we see the magic of Windows PowerShell PSRemoting. We have learned how to use it.

In this blog post, we are going to add a new windows feature by doing a PSRemoting to our remote server, or you can say that, by sitting on our own laptop, listening to the music, and we are going to configure our server remotely.

Cool ! No?

To  see the list of all available feature and roles available , which  we can deploy on our server we uses the Get-WindowsFeature cmdlet.

In the below screenshot, you can see, that I have PSRemoted to our Windows 2012 R2 Server. When we run the Get-WindowsFeature cmdlet, it has returned the list of all windows features.

1

So, how do you know, which feature is install or not?

We can check it by :

  • If the feature is already installed, then it's "Install State" is Installed, otherwise it's "Install State" is Available.
  • You can see a cross [X] in the front of installed features. and empty [  ] in the front of the feature/role which is available to install but not installed yet.

Picture1

If you want to know about any specific feature thatif it is installed or not, then user Get-WindowsFeature  and then provide the name of the feature in -Name parameter.

For example ,after run the below command you can see  that 'Management Tools' are not installed on this server.

Get-WindowsFeature -Name 'Web-Mgmt-Tools'

6

To install any feature or role, we use the Install-WindowsFeature cmdlet.

The usage of cmdlet is very simple. Type cmdlet and then provide the name of feature to install.

Let's try installing XPS Viewer. The below command is very simple and not need to

 

Install-WindowsFeature XPS-Viewer

3

In the below screenshot, we can see, that our feature install successfully.

5

That's all for now, see you in my next blog post.

Aman Dhally, Manya Kaur

Regards.
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel for PowerShell video tutorials. You can download all of my scripts from “Microsoft TechNet Gallery”.

Tuesday, June 23, 2015

Managing Windows Server 2012 R2 Using PowerShell : Part-7 : Joining Server to the domain.

 

  1. Part 1 : Windows Server 2012 R2 Installation.
  2. Part 2 : Exploring PowerShell Default Settings.
  3. Part 3 : Getting and setting server name.
  4. Part 4 : Getting IP Address of the server.
  5. Part 5 : Setting IP Address of the server.
  6. Part 6 : Checking if Server is member of domain.

Part - 7 : Joining to the domain.

Configuration

In the previous blog post, we have see, that how can we  check if the server is the part of the domain or not.

Today, we are going to add our server to the domain, and make it the member of our domain environment.

Adding to the domain ( non PowerShell way ).

We can add our server to the domain in two ways. One is by adding it manually and the second way is by using the NetDom.exe command.

  1. Manually ( I am sure, that you know, how to do that)
  2. By using the NETDOM.exe command.
    1. Aman Dhally , Manya Kaur
    2. usage of Netdom.exe is simple. you can visit this link to know about, how can use use it.  https://support.microsoft.com/en-us/kb/150493)

Adding to the domain ( The PowerShell way )

Adding server to domain by using PowerShell is very simple. To add server to a domain using PowerShell, we mainly need two things.

  1. Username and Password with domain adding privileges (admin account may be ).
  2. Domain Name.

To keep things simple for now, we are going to to the following:

  1. Saving username and password in to variable using Get-Credential cmdlet.
  2. Add server to the domain, by using Add-Computer cmdlet.

Let's start.

let's save our admin username and password in to a $credential variable. When you run the below command, it opens a credential window, provide your domain admin account username  ( or account with adding to domain privileges ) and it's password.  I main use the DomainNam\UserName format in username tab.

 

$credential = Get-Credential

 

1

 

Now, run the Add-Computer cmdlet, in -Credential parameter provide the name of variable which we have created above, and in -DomainName provide the name of domain name and hit enter.

 

Add-Computer -Credential $credential -DomainName 'myDomain.com'

 

2

In the above screenshot you can see, that our above command has run successfully and telling us to restart our server, Let's restart it.

After restarting the server, it was asking me for domain username and password to enter ( that means it joins to the domain successfully) , after login in , I checked using PowerShell, if the server is member of domain or not, in the below screenshot you can see, it is.

3

That's all for now, see you in my next blog post.

tumblr_ma3iifkEXw1r19a45o5_250

Regards.
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel for PowerShell video tutorials. You can download all of my scripts from “Microsoft TechNet Gallery”.