Solved

Checking if Windows Server joined to the domain or not ?

Posted on 2011-09-05
3
429 Views
Last Modified: 2012-05-12
Hi People,

Given a list of IP address or Server name, can we actually list which server is currently joined to the domain or not (WORKGROUP only) using Powershell ?
0
Comment
3 Comments
 
LVL 13

Assisted Solution

by:Felix Leven
Felix Leven earned 50 total points
ID: 36486893
Here is a PowerShell script which you can use to identify the domain membership of remote computers .  You can use a text file as an input file with all your computers names.

Not my script, link only:
http://portal.sivarajan.com/2010/02/identify-domain-membership-powershell.html
0
 
LVL 4

Assisted Solution

by:ZeevM333
ZeevM333 earned 50 total points
ID: 36488025
http://www.softpedia.com/progDownload/nbtscan-Download-100891.html
download this.
Save the .exe file under C:\
i'll assume your IP is 10.1.2.12 for this example.
Launch Command prompt and type the following while you're under C:\>

nbtscan-1.0.35.exe 10.1.2.1-254

Will give you the computer names IP's and if in domain or workgroups and which domains and workgroups.

Can simply supply a list of IP's as well for it to check...use the help menu to find what you need.
0
 
LVL 1

Accepted Solution

by:
m_rayansaz earned 400 total points
ID: 36492588
Ok since you have your list you can use is as an input file for a script which you run with domain admin.
You can use these comands in the script to find out uniq codes relevant to each version of windows; and then isolating server systems from the list.

$SystemHash = @{}  # Initialize the variable as a hashtable
$SystemHash["build"] = (Get-WmiObject Win32_OperatingSystem).BuildNumber
$SystemHash["SPNumber"] = (Get-WmiObject Win32_OperatingSystem).CSDVersion
$SystemHash["Caption"] = (Get-WmiObject Win32_OperatingSystem).Caption
$SystemHash["SKU"] = (Get-WmiObject
Win32_OperatingSystem).OperatingSystemSKU


for example you can have this script:

#
$Domain_Success_File = New-Item -type file -force "c:\temp\Domain_Success_File.txt"
$Domain_Failed_File = New-Item -type file -force "temp\Domain_Failed_File.txt"
$InputFile = Get-Content X:\2009\Scripts\Computers.txt
ForEach ($Comp in $InputFile){$adminpath = Test-Path \\$Comp\admin$
if ($adminpath -eq "TRUE"){
                  $compOS = get-wmiobject Win32_OperatingSystem -comp $computer
                  $compOSF = $compOS.Caption
                  $compSP = get-wmiobject Win32_OperatingSystem -comp $computer
                  $compSPF = $compSP.ServicePackMajorVersion
                  .
                  .
                  .
                  }
.
.
.
}


note I have used some part of codes from http://www.sivarajan.com/scripts.html but it's not complete, just as guideline.
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

A brief introduction to what I consider to be the best editor for PowerShell.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

821 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