- Part 1 : Windows Server 2012 R2 Installation.
- Part 2 : Exploring PowerShell Default Settings.
- Part 3 : Getting and setting server name.
- Part 4 : Getting IP Address of the server.
- Part 5 : Setting IP Address of the server.
Part - 6 { Domain Membership.}
In the previous blog post, we have seem, that how can we set a static IP address in our Windows 2012 R2 Server by using PowerShell.
Our next step is to find is server is the member of our domain environment or not.
Checking Domain membership( the non-PowerShell way )
There are few ways to check domain membership.
- Manually.
- lol.!
- By using Net.exe command.
Checking Domain membership ( The PowerShell way )
Now let's check if our server is member of domain or not by using PowerShell.
There are quite few ways to check if you server is member of domain or not.
Just for your information or knowledge there are few PowerShell environment variable which you should be aware of, in writing script for server, they become very handy.
- This environment variable contains the name of your domain DNS name. If your server is part of domain.
- My laptop is part of domain, this variable do exist of my laptop, but this variable is not available of our server. So I am assuming,that it created after joining of domain.
- The best way to check, if server is part of domain or not, is by using the Win32_Computersystem class.
- Get-WmiObject -Class Win32_ComputerSystem
- Run the above command, and you will see a lot of information related to domain joining.
- Like
- Name of Workgroup.
- Name of Domain.
- Domain Role.
Now, you must be thinking, that how you can simple check, with Yes / No, if the server is part of domain or not. It's easy, the above output, has a property named "PartOfDomain", if your server is part of domain the value contains true otherwise it will contain false.
Run the below command and see the output.
(Get-WmiObject -Class Win32_ComputerSystem).PartOfDomain
In the above screenshot, you can see that output of above command is false, that means our server is not a member of domain yet.
Now, in next blog post, we will see, how can we add our sever to the domain.
Wishing you all the best and have fun.
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”.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.