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
326 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 500 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

Give your grad a cloud of their own!

With up to 8TB of storage, give your favorite graduate their own personal cloud to centralize all their photos, videos and music in one safe place. They can save, sync and share all their stuff, and automatic photo backup helps free up space on their smartphone and tablet.

Question has a verified solution.

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

Short answer to this question: there is no effective WiFi manager in iOS devices as seen in Windows WiFi or Macbook OSx WiFi management, but this article will try and provide some amicable solutions to better suite your needs.
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

867 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now