'====================================================================
'= Show Supervisor Equivalent VBScript sample - Copyright © 2007, Dave Moats
'=
'= This sample is provided 'as-is', without any express or implied warranty.
'= In no event will the authors be held liable for any damages arising from
'= the use of this sample code.
'=
'= Permission is granted to anyone to use this sample code for any purpose,
'= including commercial applications, subject to the following restrictions:
'=
'= The origin of this code must not be misrepresented;
'=       you must not claim that you wrote the original code.
'=       If you use this code, an acknowledgment in the
'=       documentation is requested - shown below:
'=
'= Portions Copyright © 2007, Dave Moats (http://www.davemoats.com/).
'=
'====================================================================
'====================================================================
'==
'== nwSupervisors.vbs - script to list all the users on a Server
'==                               that have supervisor equivalent
'==
'====================================================================
set fso = createobject ( "Scripting.FileSystemObject")

'====================================================================
'== Get the NetWare Server and the output file
'====================================================================
if wscript.arguments.count = 0 then
   wscript.echo ( "Usage: nwSupervisors.vbs <Server> <Path to Ouput file>")
   srvPath = inputbox ( "Enter the server that you want to list the users with supervisor equivalent:")
   outPath = inputbox ( "Enter the path to the output file:")
elseif wscript.arguments.item ( 0) = "/?" Or wscript.arguments.item ( 0) = "-?" then
   wscript.echo ( "Usage: nwSupervisors.vbs <Server> <Path to Ouput file>")
   wscript.quit ( )
else
   srvPath = wscript.arguments.item ( 0)
   outPath = wscript.arguments.item ( 1)
end if

'====================================================================
'== validate that there was something passed to the script
'====================================================================
if srvPath = "" or outPath = "" then
   wscript.echo ( "There were not enough arguments passed to the script")
   wscript.echo ( "Usage: nwSupervisors.vbs <Server> <Path to Ouput file>")
   wscript.quit ( )
end if

'====================================================================
'== open the output file
'====================================================================
set outFile = fso.createtextfile ( outPath)

on error resume next

'====================================================================
'== Now try to bind to the 3.x server
'====================================================================
srvPath = "NWCOMPAT://" & srvPath
set srvObj = getobject ( srvPath)

'====================================================================
'== Apply the user filter and then list the users
'====================================================================
srvObj.filter = "User"

outFile.writeline ( "User Name,Supervisor Equivalent,Password Required,Last logon")

for each Member in srvObj

      outMsg = Member.name

      temp = Member.get ( "IsAdmin")

      if temp <> "" then
            outMsg = outMsg & "," & temp & ","
      else
            outMsg = outMsg & ",FALSE,"
      end if

      outMsg = outMsg & Member.PasswordRequired & ","

      dte = Member.lastlogin

      if dte <> "" then
            outMsg = outMsg & dte
      else
            outMsg = outMsg & "Never"
      end if

      outFile.writeline ( outMsg )

      outMsg = ""

next

'====================================================================
'== Dump the reference to the server
'====================================================================
set srvObj = nothing

'====================================================================
'== Clean up the out file reference and the file system object
'====================================================================
outFile.close
set outFile = nothing

set fso = nothing

wscript.quit ( )



Copyright © 2005 - 2013 Dave Moats.  All rights reserved.  Links: Copyright © by their respective owners.
NO WARRANTIES EXTENDED.  Void where prohibited by law.  Please report any issues or broken links.
You may link to this site freely from your own site.  You may quote from this site, but please include a link to the original source on the originating site.