资源描述:
《Windows脚本编程核心技术精解Chapter24.pdf》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、4684-8ch24.f.qc3/3/009:45AMPage669Chapter24ManagingWindowsNT/2000ServerInThisChapterManageWindowsNTthroughtheAPI—add/deleteusers,changepermissions,andchangegroupmembershipFindoutaboutADSIandhowyougetitDiscovertheADSIobjectmodel,andchangeuseraccountpropertiesManageservices:start,stop,
2、andpausethem,evenonremotesystemsShutdownyourlocalmachineoranyremotecomputerAddsecretRegistrykeystoautomaticallylogontoWindowsNTScriptsareperfectforadministeringWindowsNT/2000.ThroughAPIcallsandthenewADSI(ActiveDirectoryServiceInterface),yourscriptscanmanageuseraccounts,fileshares,print
3、ers,andservices.Inconjunctionwiththefilesystemmethods,youcaneasilytransferhundredsofuserprofilesinamatterofminutes.Inthischapter,youlearnhowtouseboththeAPIandADSItomanageallkindsofserver-relatedtasks.ManagingWindowsNT/2000SecurityManagingWindowsNT/2000canbeannoyingattimes—it’sjusttoomuch
4、worktoadministerhundredsofuseraccountsmanually.Isn’ttheresomemacrolanguagethatcanautomaticallytakecareofroutinework?Thereis.VBScriptandtheWindowsScriptingHostcanhelpyouadministerWindowsNT/2000,andMicrosofthasmadeVBScripttheofficialnewautomationlanguageofWindows2000.Thisshowsyouthenewemph
5、asisMicrosoftputsonVBScript.4684-8ch24.f.qc3/3/009:45AMPage670670PartV:AccessingHiddenComponents■■However,VBScriptitselfisonlytheframework.Itdoesn’tprovideanymethodstoaccessuseraccountsandchangesecuritysettings.Therearetwowaystoaddthesecapabilities:■WriteyourownCOMobjects.You’veseenmanyC
6、OMobjectsthroughoutthisbookserveasscriptingextensions,andWindowsNTmanagementfunctionsprovidedbytheAPIcaneasily“wrap”insideCOMobjects.■AddADSItoyoursystem.ADSIisthenewmanagementstandardintroducedwithWindows2000.It’sageneralinterfacetostandardizehowscriptstalktodifferentnamespaces.Youdon’t
7、needWindows2000totakeadvantageofADSI,though.ADSIisavailableseparately,andit’sfree.AllyouneedistodownloadtheADSIupdate.ThebigADSIadvantageisitsavailability:YoucanfinditonanyWindows2000machine,andyoucanaddittootherWindowsversions.Also,ADSIisageneralinterface,andyoucanaccess