-
Oct 16th, 2005, 08:10 PM
#1
[ADSI] - Check If User Acount Is Enabled/Disabled
Not too much explanation needed for this one.
VB Code:
Option Explicit
Private Sub Command1_Click()
Dim oUser As Object
Set oUser = GetObject("WinNT://ComputerName/UserName")
If oUser.AccountDisabled = True Then
MsgBox oUser.Name & " Disabled!"
Else
MsgBox oUser.Name & " Enabled!"
End If
Set oUser = Nothing
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
-
Oct 17th, 2005, 05:20 AM
#2
Re: [ADSI] - Check If User Acount Is Enabled/Disabled
Apparently is only works with NT/Win2000 as I get an automation error on XP Pro.
-
Oct 18th, 2005, 09:22 AM
#3
Re: [ADSI] - Check If User Acount Is Enabled/Disabled
Nope, I tested in on XP Pro SP1. Automation errors are usially an incorrect computer name or user name. Are you running Active Directory?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
-
Oct 18th, 2005, 12:36 PM
#4
Re: [ADSI] - Check If User Acount Is Enabled/Disabled
Originally Posted by RobDog888
Are you running Active Directory?
No...nevermind.
-
Oct 18th, 2005, 12:48 PM
#5
Re: [ADSI] - Check If User Acount Is Enabled/Disabled
Hmm, seems that using NTDS or ADSI makes no difference. The format of the code is the same. I tested it on my XP system which is not part of my domain that is running AD nor my user account. Still worked.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
-
Oct 3rd, 2006, 11:19 PM
#6
Member
Re: [ADSI] - Check If User Acount Is Enabled/Disabled
It doesn't matter if your computer is running ad or not. As long as it has a network or internet connection to the computer which does run it, even if your computer doesn't use it, it can still get information from it and query it. All that is needed is a computer name/domain name, and the username you want to query.
Knightcon
Mess With The Best,
Die Like The Rest.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|