+ Post New Thread
Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
Scripts Thread, script commands in Coding and Web Development; Originally Posted by gecko Code: Dim objUser, objComputer ComputerName = "server_name" '<<-- alter this to your servers name Set objComputer ...
  1. #16
    chalkwellstu's Avatar
    Join Date
    Sep 2007
    Location
    Leigh on Sea
    Posts
    148
    Thank Post
    5
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Quote Originally Posted by gecko View Post
    Code:
    Dim objUser, objComputer
    
    ComputerName = "server_name" '<<-- alter this to your servers name
    
    Set objComputer = GetObject("WinNT://" & ComputerName)
    
    For each objUser in objComputer
    
    wscript.echo objUser.name  '<-- this line
    
    next
    in the above code where I have commented this line

    Is where you can change it from objUser.name to

    objUser.Description

    OR

    objUser.FullName

    as per the win32_UserAccount class :

    http://msdn2.microsoft.com/en-us/lib...07(VS.85).aspx

    If you could test that and give me a few examples back of each outcome

    ie what you get when you use fullname

    what you get when you use description

    etc

    so that I know if it is returning any useful info ie if it always returns the word student or staff in description

    If thats the case then that may be easier then trying to determine if there last name is outputted as a null string ie nothing to establish that its a staff member and if not then its a student.

    you need to alter the first line to the name of your server ie

    ComputerName = "MyServer" '<<-- alter this to your servers net bios name or i.p address

    Hey thanks Gecko i really appreciate your time here, i'll insert this lot and see what i get. can you trace out a script into a txt file?

  2. #17

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    10,053
    Thank Post
    3,585
    Thanked 1,123 Times in 1,025 Posts
    Rep Power
    377
    yes you can output the data by using the fso :
    Code:
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set ts = fso.CreateTextFile ("Users.txt", true)
    
    Dim objUser, objComputer
    
    ComputerName = "server_name" '<<-- alter this to your servers name
    
    Set objComputer = GetObject("WinNT://" & ComputerName)
    
    For each objUser in objComputer
    
    ts.Write objUser.name  & vbcrlf '<-- this line
    
    next
    That way it creates a text file called users in the same place where your script is located, so when you have objUser.name, run the script, it will create the text file, hopefully with

    first_name
    second_name
    third_name

    etc

    then copy that text file and call it name.txt

    then change that one line to

    objUser.FullName

    and repeat so that you change the name of the file so it does not over write it and then change the line in the script again to

    objUser.Description

    Then post all 3 text files ( assuming that the output into the text file is as per above with one name on each line )

    Then I can download them and have a look and finish the script off.

    You are probably better off taking a few examples from each and pm'ing me with those and put comments in so I know which examples are students and which ones are staff members.
    Last edited by mac_shinobi; 29th January 2008 at 05:25 PM.



SHARE:
+ Post New Thread
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Server 2003 run commands.
    By starscream in forum Wireless Networks
    Replies: 3
    Last Post: 26th June 2007, 11:49 AM
  2. Running local commands remotely
    By MK-2 in forum Windows
    Replies: 6
    Last Post: 2nd March 2007, 11:31 AM
  3. VLAN Simulator - Commands
    By Nij.UK in forum Wireless Networks
    Replies: 1
    Last Post: 20th February 2007, 02:27 PM
  4. unix and sql commands
    By danIT in forum General Chat
    Replies: 9
    Last Post: 14th February 2007, 02:19 PM
  5. Avantis CDServe shortcut commands
    By WithoutMotive in forum How do you do....it?
    Replies: 2
    Last Post: 18th July 2006, 11:36 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •