Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Detecting Computer Name with a twist; need some ideas

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,47729
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Detecting Computer Name with a twist; need some ideas
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Detecting Computer Name with a twist; need some ideas - 5/30/2007 4:56:55 AM   
  stephen.wolfe

 

Posts: 83
Score: 0
Joined: 8/9/2005
From: Tampa, FL
Status: offline
I just got an unusual request from my supevisor.  When anyone in our OU logs onto certain clients then normal
post login script processing must halt.  He said the networking guy said the computers could be put in a security group for detection.  That's my first question, I thought only user accounts could be put into security groups; is this true?  It is true then how would you detect that group?

Any ideas here would be gratefully entertained.

V/R

Steve

_____________________________

Steve
 
 
Post #: 1
 
 RE: Detecting Computer Name with a twist; need some ideas - 5/30/2007 5:21:37 AM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
Yes, computers can be placed in security groups in AD.  You would then script a lookup to see which groups a particular computer is a member of,


      
(code taken from Cruto)


_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to stephen.wolfe)
 
 
Post #: 2
 
 RE: Detecting Computer Name with a twist; need some ideas - 5/31/2007 10:11:59 PM   
  stephen.wolfe

 

Posts: 83
Score: 0
Joined: 8/9/2005
From: Tampa, FL
Status: offline
DS, Thanks for the tip.  I did it a bit different but I have a question regarding simplicity.  Look at the code below:

OBTW, anyone can chime in with an improvement -- I need all the improvement I can get.  <ggg>


      

What I would like to know is, is there a way to simply the adspath, mine is long, long, long ... sheesh ...


      

How can the above be simplified?  Also, who's idea was it that you had to specify the OUs from inside out  and the DC from outside in?
That makes no sense at all.

Anyway, the above subroutine works, I would just like to improve it if possible.
The subroutine is a re-hash of the bubble sort script you can find up on the Scripting Guys site.  A lot of useful stuff there.

TIA

_____________________________

Steve

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 3
 
 RE: Detecting Computer Name with a twist; need some ideas - 5/31/2007 11:24:09 PM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
Well, have you ever looked at the ADSystemInfo object?

[code]
Sub ExamRoomLookUp
  strExamExit = "N"
  strComputer = objNetwork.ComputerName

  Set oAD = CreateObject("ADSystemInfo")
  strComputerDN = oAD.ComputerName

  Dim arrNames()
  intSize = 0
  Set objGroup = GetObject("LDAP://" & strComputerDN)
  For Each strUser in objGroup.Member
      Set objUser =  GetObject("LDAP://" & strUser)
      ReDim Preserve arrNames(intSize)
      arrNames(intSize) = objUser.CN
      intSize = intSize + 1
  Next
  For i = (UBound(arrNames) - 1) to 0 Step -1
      For j= 0 to i
          If UCase(arrNames(j)) > UCase(arrNames(j+1)) Then
             strHolder = arrNames(j+1)
             arrNames(j+1) = arrNames(j)
             arrNames(j) = strHolder
          End If
      Next
  Next
  For Each strName in arrNames
      Wscript.Echo strName
      If strComputer = strName Then
         'Wscript.Echo "Computer " & strComputer & " is located in a Exam Room."
         strExamExit = "Y"
      Else
         'Wscript.Echo "Computer " & strComputer & " is NOT an Exam Room computer."
      End If
  Next
End Sub




_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to stephen.wolfe)
 
 
Post #: 4
 
 RE: Detecting Computer Name with a twist; need some ideas - 6/1/2007 1:27:29 AM   
  stephen.wolfe

 

Posts: 83
Score: 0
Joined: 8/9/2005
From: Tampa, FL
Status: offline
Nope, I haven't seriously looked at the ADSInfo Object, but I will now.

Thanks and I see you left the bubble sort in ...

_____________________________

Steve

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 5
 
 RE: Detecting Computer Name with a twist; need some ideas - 6/1/2007 4:47:49 AM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
Heh... I only looked at simplifying the adspath.

_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to stephen.wolfe)
 
 
Post #: 6
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Detecting Computer Name with a twist; need some ideas Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts