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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
f5 Persistence 14 63
vSphere 5.5 - move subnet to another data center? 2 20
Internet Service Provider 3 55
svi stops eigrp advertisement 13 34
Data center, now-a-days, is referred as the home of all the advanced technologies. In-fact, most of the businesses are now establishing their entire organizational structure around the IT capabilities.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

820 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