Show me some examples:
Most of these examples were taken from the Visual Basic Site 15 seconds and modified
to reflect proper usage with the Windows Scripting Host. http://www.15seconds.com
adding a user to a group
How do I add a user to a group using ADSI?
Code:
$DomainString = @DOMAIN
$UserString = "jdoe"
$GroupString = "GroupName"
$GroupObj = GetObject("WinNT://" + $DomainString + "/" + $GroupString)
$GroupObj.Add ("WinNT://" + $DomainString + "/" + $UserString)
$DomainObj = ""
$GroupObj = ""
adding a global user to a local group
How do I add a domain user to a local group using ADSI?
Code:
$PdcName = "ComputerName"
$ComputerName = "ComputerName"
$UserString = "jdoe"
$GroupString = "GroupName"
$GroupObj = GetObject("WinNT://" + $ComputerName + "/" + $GroupString)
$GroupObj.Add ("WinNT://" + $PdcName + "/" + UserString)
$DomainObj = ""
$GroupObj = ""
creating a share
How do I create a share using ADSI?
Code:
$FservObj = GetObject("WinNT://ComputerName/lanmanserver")
$newshare = FservObj.create("fileshare","test")
$newshare.path = "C:\temp"
$newshare.setinfo
$newshare =
starting an NT service
How do I start the browser service using ADSI?
Code:
$BrowserServiceObj = GetObject("WinNT://ComputerName/browser")
$BrowserServiceObj.start
$BrowserServiceObj = ""
WMI or What is called Windows Management Instrumentation..
http://cwashington.netreach.net/depo/default.asp?topic=wmifaq
Interesting site - http://www.dx21.com/INDEX.ASP?NTI=1&SI=1
http://msdn.microsoft.com/ - Microsoft Development Network
Technet Script Center
Windows Script Home Page
WMI - The missing manual -
WMI Scripting: The Missing Manual, Part 1
Download ADSI 2.5 -
Active Directory Service Interfaces (ADSI) 2.5
ADSI Overview -
Active Directory Service Interfaces Overview
Object Libraries
Type Library Viewer for Kix?
TypeLibViewer
Microsoft has an object viewer... Get it at: http://www.microsoft.com/com/resources/oleview.asp
All Attributes
The following attributes are defined by Active Directory
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adschema/adschema/attributes_all.asp
Global Attributes
The following are the attributes that are contained in the global catalog.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adschema/adschema/attributes_global.asp
LDAP Attributes for Active Directory
http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.htm
LDAP Properties for the User object
http://www.rlmueller.net/Name_Attributes.htm
Provider Support of ADSI Interfaces
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/provider_support_of_adsi_interfaces.asp
A Summary of the X.500(96) User Schema for use with LDAPv3
http://www.cse.ohio-state.edu/cgi-bin/rfc/rfc2256.html