Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Need an NT command line script/batch file to report all domain users with no logon script configured

Posted on 2004-07-31
2
Medium Priority
?
334 Views
Last Modified: 2010-04-11
I need an NT command line script/batch file to report all domain users with no logon script configured. Even better, another one to update them with the right logon script in bulk
0
Comment
Question by:cmitch2000
  • 2
2 Comments
 
LVL 7

Accepted Solution

by:
TheKenman earned 2000 total points
ID: 11685344
Try this (might need minor tweaking):

sDomain = InputBox("Enter Domain to update:", "ENTER DOMAIN")
updLoginScript sDomain

'helper fn()'s
' hides the crucial IWAM_ abd IUSR_ accounts
' to prevent accidental catastrophe
Function notCrucial(sObj)
      sObj = UCase(Left(sObj,5))
      If sObj = "IWAM_" Or sObj = "IUSR_" Then
            notCrucial = FALSE
      Else
            notCrucial = TRUE
      End If
End Function

'return FALSE if input is not valid
Function notEmpty(obj)
   Select Case obj
      Case "" : notEmpty = FALSE
      Case isEmpty(obj) : notEmpty = FALSE
      Case isNull(obj) : notEmpty = FALSE
      Case Else : notEmpty = TRUE
   End Select
End Function

'MAIN()
Function updLoginScript(strDomain)
      On Error Resume Next
      Set oDom = GetObject("WinNT://" & strDomain)
      oDom.Filter = Array("user")
      If Err <> 0 Then
            updLoginScript = msgbox "Bad Domain!!\n\nDomain: " & strDomain
      Exit Function
      Else
      For Each oUser in oDom
         If notCrucial(oUser.Name) Then
            If notEmpty(oUser.LoginScript) Then
               oUser.LoginScript = "Login script file name"
               oUser.SetInfo  
            End If
         End If
      Next
      End If
      Set GroupObj = Nothing
      If Err <> 0 Then
      msgbox("Script completed with errors.")
         updLoginScript = FALSE      
   Else
      msgbox("Script successfully completed.")
         updLoginScript = TRUE      
   End If
End Function
0
 
LVL 7

Expert Comment

by:TheKenman
ID: 11701266
Thanks :)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

How to fix a SonicWall Gateway Anti-Virus firewall blocking automatic updates to apps like Windows, Adobe, Symantec, etc.
In this article, the configuration steps in Zabbix to monitor devices via SNMP will be discussed with some real examples on Cisco Router/Switch, Catalyst Switch, NAS Synology device.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

916 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