1 / 23

Don’t have to be “dev” to script my work

Don’t have to be “dev” to script my work. Peter Zdovc, SRC.SI MCSE Messaging Ljubljana, marec 2006. Vsebina. Skripting okolja WMI objektni model - upravljanje postaj ADSI objektni model - upravljanje z aktivnim imenikom Vprašanja. Okolja za izvajanje skript. ukazna vrstica WSH KIKS32

Download Presentation

Don’t have to be “dev” to script my work

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Don’t have to be “dev” to script my work Peter Zdovc, SRC.SI MCSE Messaging Ljubljana, marec 2006

  2. Vsebina • Skripting okolja • WMI objektni model - upravljanje postaj • ADSI objektni model - upravljanje z aktivnim imenikom • Vprašanja

  3. Okolja za izvajanje skript • ukazna vrstica • WSH • KIKS32 • ...

  4. Windows Scripting Hosthttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwsh/html/msdn_wsh_wp.asp • namenjen za • izvajanje administrativnih opravil • izvajanje “command-line” orodij • komponente so • skriptne datoteke (*.vbs, *.js,...) • skriptni gostitelji • izvajalci skriptnih jezikov • COM objekti

  5. Skriptni jeziki • Batch procedure • VBScript • JScript • Perl, REXX, TCL, Python • Kiks32 (npr. ScriptLogic) • MONAD • ...

  6. VBS vs. VBA http://www.thirdm.com/scripting/vbscript.htm http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/f65b4a7c-eb8c-47f1-ba36-16ad8793026d.asp

  7. Ponudniki • ADSI – LDAP://, GC:// • WMI – winmgmts:// • Windows NT directory – WinNT://

  8. Orodja • WMI Administrative Tools • Scriptomatic • Windows Administrative Tools • ADUC • ADSIEdit • LDP • ...

  9. Kaj je WMI • Windows Management Instrumentation • Tehnologija za (daljinsko) upravljanje WinOS • Temelji na standardni shemi objektov za upravljanje – CIM • MS izvedba WBEM (Web-Based Enterprise Management) • WBEM usklajuje skupina za distribuirano upravljanje (DMTF)http://www.dmtf.org/home

  10. Uporaba WMI • Poizvedovanje • Spreminjanje sistemskih nastavitev • Nadzor nad delovanjem sistema in aplikacij • Spremljanje sistemskih dogodkov

  11. Arhitektura WMI

  12. Nekateri standardni ponudniki

  13. Povezava na WMI – 1 (auth) Set objLocator = CreateObject("WbemScripting.SWbemLocator") Set objWMIService = objLocator.ConnectServer(strComputer,"root/cimv2", strUserName, strPassword) objWMIService.Security_.ImpersonationLevel = 3 Set colItems = objWMIService.ExecQuery(strWQL,,48)

  14. Povezava na WMI – 2 (brez auth) Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") objWMIService.Security_.ImpersonationLevel = 3 Set colItems = objWMIService.ExecQuery(strWQL,,48)

  15. Demo - WMI • Uporaba Scriptomatic • Uporaba VBA

  16. Povezava na AD Set obj = GetObject("LDAP://“ & absoluteDN) Set objRootDSE = GetObject("LDAP://rootDSE")

  17. Branje atributov attributeValue = objUser.Get “attributName” za polja array – objUser.GetEx

  18. Pisanje atributov objUser.Put “attributName”, attributValue za polja array – objUser.PutEx zapisujemo v ti. localcache, nato objUser.SetInfo (iz localcache v AD)

  19. Kreiranje objektov Set objOU= GetObject("LDAP://“ & absoluteDN) ojbOU.Create(“objectClass”, objectName)

  20. DEMO - AD • Kreiranje uporabnika

  21. Masovno iskanje Adodb.Connection Provider=ADsDSOObject ADODB.Command search base (< >) LDAP filter vrnjeni atribut(i) – ločeni z vejico scope

  22. DEMO - AD • Spreminjanje atributov uporabnika

  23. Viri • Microsoft Windows 2000 Scripting Guide • http://www.microsoft.com/technet/scriptcenter/guide/sagsas_overview.mspx • Script center • http://www.microsoft.com/technet/scriptcenter/default.mspx • Platform SDK: Active Directory • http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ad/ad/active_directory.asp • Scripting Week 3: Script It Up a Notch • http://www.microsoft.com/technet/scriptcenter/webcasts/sw3.mspx • Scripting and Batch Programming Resources • http://labmice.techtarget.com/scripting/default.htm • ...

More Related