microsoft windows server n.
Skip this Video
Loading SlideShow in 5 Seconds..
Microsoft Windows Server PowerPoint Presentation
Download Presentation
Microsoft Windows Server

Loading in 2 Seconds...

play fullscreen
1 / 17

Microsoft Windows Server - PowerPoint PPT Presentation

  • Uploaded on

Microsoft Windows Server. Terms. VBScript JavaScript Script Objects Attributes CSVDE LDIFDE. Scripting. What is VBScript? VBScript is a scripting language A scripting language is a lightweight programming language

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

Microsoft Windows Server

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
    Presentation Transcript
    1. Microsoft Windows Server

    2. Terms VBScript JavaScript Script Objects Attributes CSVDE LDIFDE

    3. Scripting • What is VBScript? • VBScript is a scripting language • A scripting language is a lightweight programming language • VBScript is a “light” version of Microsoft's programming language Visual Basic • How Does it Work? • Web->When a VBScript is inserted into a HTML document, the Internet browser will read the HTML and interpret the VBScript. The VBScript can be executed immediately, or at a later event. • Networking->A VBScript can be compared to a simple batch file. It is in essence a program that will be run by Windows Scripting Host. The benefit/advantage over the batch file is that it is extremely more powerful and flexible.

    4. Windows Scripting Host • There are two ways to launch the scripts. • Wscript (default): GUI Windows scripting host

    5. Windows Scripting Host Cscript: command line scripting host

    6. Examples • Open Notepad • Type the following commands • Option Explicit • Wscript.Echo "Hello, World!“ • Save as hello.vbs

    7. Examples • Mapping a network drive ‘Map drive to share Set WshNetwork =WScript.CreateObject("WScript.Network") WshNetwork.MapNetworkDrive "Z:", \\dp2\shared

    8. Examples 'Function to set a user's password ' 'For more scripts, visit Function SetPassword(domain, username, password) 'Call this Function to set a user's password On Error Resume Next Dim user Set user = GetObject("WinNT://" & domain & "/" & username & "",user) user.SetPassword(password) SetPassword = Err.Number On Error Goto 0End Function 'example Dim username, password, domain domain = InputBox("On what domain", "Domain", "") username = InputBox("Enter a username", "User Name", "") password = InputBox("Enter a new password", "Password", "") If SetPassword(domain, username, password) = 0 Then MsgBox "Successful" Else MsgBox "Error Occurred" End If

    9. Examples Creating an OU Set objDomain = GetObject("LDAP://dc=fabrikam,dc=com") Set objOU = objDomain.Create("organizationalUnit", "ou=Management") objOU.SetInfo

    10. Examples Move a Group Within a Domain Moves a group account from the HR OU to the Users container. Set objOU = GetObject("LDAP://cn=Users,dc=NA,dc=fabrikam,dc=com") objOU.MoveHere "LDAP://cn=atl-users,ou=HR,dc=NA,dc=fabrikam,dc=com", _vbNullString

    11. Examples • Create User Account • Creates a user account in Active Directory. This script only creates the account, it does not enable it. Set objOU = GetObject("LDAP://OU=management,dc=fabrikam,dc=com") Set objUser = objOU.Create("User", "cn=MyerKen") objUser.Put "sAMAccountName", "myerken“ objUser.SetInfo

    12. Example • Create 1000 users in AD Set objRootDSE = GetObject("LDAP://rootDSE") Set objContainer = GetObject("LDAP://cn=Users," & _ objRootDSE.Get("defaultNamingContext")) For i = 1 To 1000 • Set objLeaf = objContainer.Create("User", "cn=UserNo" & i) • objLeaf.Put "sAMAccountName", "UserNo" & I • objLeaf.SetInfo Next WScript.Echo "1000 Users created."

    13. Assigning Login Scripts • Policy based within Group Policy • Computer Specific • Startup/Shutdown Scripts • User Specific • Logon/Logoff Scripts • Run asynchronously (“hidden, behind the scenes”) • W2k3 Machines create share called NETLOGON • \winnt\sysvol\”domain name”\scripts for backwards compatibility

    14. Scripting Resources • • •

    15. CSVDE & LDIFDE • CSVDE: CSV Directory Exchange • Can import/export objects from Active Directory • Bulk import of only NEW objects. • Cannot modify existing objects • LDIFDE: Lightweight Data Interchange Format Data Exchange • Can import/export objects from Active Directory • Bulk import of objects. • Modification of EXISTING Active Directory accounts. • Resources • •

    16. CSVDE & LDIFDE • Examples • For example, you can use the following command to export all objects with the as part of their Distinguished Name (including both users and groups) into userlist.csv file: • csvde.exe -f userlist.csv -d "cn=users,DC=swynk,DC=com“ • The following will export all objects of the user object class (user and computer accounts, but not groups): • csvde.exe -f userlist.csv -r "(objectClass=user)"

    17. CSVDE & LDIFDE • The import is less straightforward. Some of attributes are owned by the system, so when running the import using the same file format, errors will result. Running export with -m switch, excludes them (by using so called SAM logic). Once the list is known, it can be populated with data for new user accounts.  • For example, the following allows you to create MarcinPolicht account in domain: • csvde.exe -i -f indata.csv • indata.csv contains the following fieldsDN,cn,displayName,distinguishedName,objectCategory,objectClass,name,sAMAccountName,givenName,sn,userPrincipalName"CN=MarcinPolicht,CN=Users,DC=swynk,DC=com",MarcinPolicht,MarcinPolicht,"CN=MarcinPolicht,CN=Users,DC=swynk,DC=com","CN=Person,CN=Schema,CN=Configuration,DC=swynk,DC=com",user,MarcinPolicht,MarcinPolicht,Marcin,Policht,