#143708 - 2005-07-15 10:12 PM
List all workstation from Domain script
|
singk
Fresh Scripter
Registered: 2002-02-14
Posts: 31
|
I've been searching for almost a day and can't find any script that will allows me to list all workstations (computer) from Domain. I mean Workstation Only or a way to identify either workstation, member server, PDC, or BDC.
This script I've below will list all computers include servers. Is there any way that I can query ONLY workstations?
Code:
$Computers=GetObject("WinNT://$Domain") $Computers.filter="Computer","" For Each $Computer In $Computers 'display computer.name here. Next
_________________________
Thanks,
Sing
|
|
Top
|
|
|
|
#143711 - 2005-07-16 03:41 AM
Re: List all workstation from Domain script
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
You could go here and download this cool little commandline app.
Quote:
Network View v1.20 (NetView.exe) Last Updated: 08/16/2001
Displays a list of all machines visible in the specified domain, based on role. Basically a command-line view of Network Neighborhood, similar to 'Net.exe View' but with the ability to filter on certain types of machines (workstations only, servers only, time servers, SQL servers, etc.). Use 'NetView /?' to view the syntax.
NOTE: This list of machines is not real-time, but compiled and shared between network segments at 12 minute intervals. New machines will not appear in the browse list immediately, it may take up to 48 minutes, depending on the complexity of your network. Likewise, machines removed from the network are not immediately removed from the browse list, it may take up to 72 minutes. For more information, see Microsoft Knowledge Base articles 188001, 102878 and 150800.
Network View
|
|
Top
|
|
|
|
#143714 - 2005-07-16 06:48 AM
Re: List all workstation from Domain script
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Here is even a WMI method to do it, you'll need to convert it for use for multiple computers.
ADSI of an OU or NETVIEW 1.2 would be much faster though.
Code:
$strComputer = "." $objWMIService = GetObject("winmgmts:" + "{impersonationLevel=impersonate}!\\" + $strComputer + "\root\cimv2") $colComputers = $objWMIService.ExecQuery("Select DomainRole from Win32_ComputerSystem") For Each $objComputer in $colComputers Select Case $objComputer.DomainRole=0 $strComputerRole = "Standalone Workstation" Case $objComputer.DomainRole=1 $strComputerRole = "Member Workstation" Case $objComputer.DomainRole=2 $strComputerRole = "Standalone Server" Case $objComputer.DomainRole=3 $strComputerRole = "Member Server" Case $objComputer.DomainRole=4 $strComputerRole = "Backup Domain Controller" Case $objComputer.DomainRole=5 $strComputerRole = "Primary Domain Controller" EndSelect $strComputerRole ? Next
|
|
Top
|
|
|
|
#143716 - 2005-07-16 08:29 AM
Re: List all workstation from Domain script
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Then who cares about them. LOL
Sir yes Sir - You have proven your worth grasshopper!
Is that something like micro-management?
I have no doubt that that every large enterprise corporation out there DOES NOT know 100% how many workstations they really have at any given point in time.
Given the numerous variables that can happen on a network with thousands of users and computers I'm not aware of anyone being 100% accurate on computer counts. Even doing a physical inventory of systems often is not accurate due to systems being moved around during the counting process.
But hey, if you have your workstations at 100% accounted for then I suppose I should be glad to know that Merlin is still alive. But thanks for the feedback. 
|
|
Top
|
|
|
|
#143717 - 2005-07-16 03:17 PM
Re: List all workstation from Domain script
|
singk
Fresh Scripter
Registered: 2002-02-14
Posts: 31
|
Quote:
$computers.filter="workstation",""
sounds cool...
Is this work with "GetObject("WinNT:" method?
_________________________
Thanks,
Sing
|
|
Top
|
|
|
|
#143718 - 2005-07-16 03:20 PM
Re: List all workstation from Domain script
|
singk
Fresh Scripter
Registered: 2002-02-14
Posts: 31
|
Quote:
Here is even a WMI method to do it, you'll need to convert it for use for multiple computers.
ADSI of an OU or NETVIEW 1.2 would be much faster though.
Eventhough Netview method is faster, but it doesn't display all workstation or offline workstation.
I'll try the WMI method when I get back to the office.
_________________________
Thanks,
Sing
|
|
Top
|
|
|
|
#143719 - 2005-07-16 03:21 PM
Re: List all workstation from Domain script
|
singk
Fresh Scripter
Registered: 2002-02-14
Posts: 31
|
Quote:
Use LDAP and pull them from specific OUs assuming you segregate them by OU.
Les, How do I or can I use the LDAP against NT4 domain?
_________________________
Thanks,
Sing
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(mole)
and 1300 anonymous users online.
|
|
|