Learn how to a build a cloud-first strategyRegister Now


Popup window on AD login

Posted on 2012-08-25
Medium Priority
Last Modified: 2012-08-26

I have some users using generic accounts that I need to disable in order they use their own personal accounts on a Windows 2008 domain. These generic accounts will be disabled at a future date.

1. Windows style pop up box to appear whenever any of these generic accounts are used to login.
2. The dialog box must require the user to click OK before it is goes away
3. Like to be able to easily control which users (generic accounts) get this message but editing one file with the list of usernames so I can use it with other accounts in the future.

Many thanks.
Question by:inforr
  • 3
  • 2
LVL 65

Accepted Solution

RobSampson earned 2000 total points
ID: 38333340
Hi, are there generic accounts part of a particular AD group that no one else is in?  You can have a login script popup for only the users in that group.



Set objNetwork = CreateObject("WScript.Network")
strGroupToCheck = "Generic Users"
Set objWinntUser = GetObject("WinNT://" & objNetwork.UserDomain & "/" & strNTLogin & ",user")
If IsMemberOfGroup(objNetwork.UserDomain, objWinntUser, strGroupToCheck) = True Then
   MsgBox "Your acount will soon be disabled."
End If

Function IsMemberOfGroup(strUserDomain, objuser, strGroup) 'the user is a member of a specified group
    IsMemberOfGroup = False
    Dim objGroup
    On Error Resume Next
    Set objGroup = GetObject("WinNT://" & strUserDomain & "/" & strGroup & ",group")
    If Err.Number Then
        IsMemberOfGroup = "Error"
        IsMemberOfGroup = objGroup.IsMember(objuser.adsPath)
        'MsgBox objUser.ADsPath
    End If
End Function

Open in new window


Author Comment

ID: 38333497
Hi Rob,

Thanks for the quick response.

Good tip about creating a group. I copied the script above, created the groupas needed and saved it as a VBS and updated the Logon scripts section of the GPO.

When the script runs it is giving an error as follows:
Script: <Path to script on sysvol>
Line: 3
Char: 1
Error: 0x80005000
Code: 80005000
Source: (null)

This happens on logon or by manually double clicking on the VBS file.

Any ideas, what may be causing this?

LVL 65

Expert Comment

ID: 38333954
Oops, change this line:
Set objWinntUser = GetObject("WinNT://" & objNetwork.UserDomain & "/" & strNTLogin & ",user")

Open in new window

to this:
Set objWinntUser = GetObject("WinNT://" & objNetwork.UserDomain & "/" & objNetwork.Username & ",user")

Open in new window



Author Comment

ID: 38334732
Perfect - thank you.
LVL 65

Expert Comment

ID: 38334933
No problem. Thanks for the grade.


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
Microsoft Office 365 is a subscriptions based service which includes services like Exchange Online and Skype for business Online. These services integrate with Microsoft's online version of Active Directory called Azure Active Directory.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

810 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