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
320 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Some time ago I was asked to set up a web portal PC to put at our entrance. When customers arrive, they could see a webpage 'promoting' our company. So I tried to set up a windows 7 PC as a kiosk PC.......... I will spare you all the annoyances I…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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…
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…

708 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

19 Experts available now in Live!

Get 1:1 Help Now