Advanced Vbscript for Microsoft Windows Administrators Ebook

Total Page:16

File Type:pdf, Size:1020Kb

Advanced Vbscript for Microsoft Windows Administrators Ebook 6-2244-2eBookFM.book Page 1 Thursday, December 15, 2005 5:22 PM 6-2244-2eBookFM.book Page ii Thursday, December 15, 2005 5:22 PM PUBLISHED BY Microsoft Press A Division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright © 2006 by Don Jones and Jeffery Hicks All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Library of Congress Control Number 2005937886 Printed and bound in the United States of America. 1 2 3 4 5 6 7 8 9 QWT 9 8 7 6 5 Distributed in Canada by H.B. Fenn and Company Ltd. A CIP catalogue record for this book is available from the British Library. Microsoft Press books are available through booksellers and distributors worldwide. For further information about international editions, contact your local Microsoft Corporation office or contact Microsoft Press Inter- national directly at fax (425) 936-7329. Visit our Web site at www.microsoft.com/mspress. Send comments to [email protected]. Microsoft, Active Directory, ActiveX, Excel, FrontPage, JScript, Microsoft Press, MSDN, Tahoma, Verdana, Visio, Visual Basic, Win32, Windows, the Windows logo, Windows NT, and Windows Server are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Other product and company names mentioned herein may be the trademarks of their respective owners. The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. This book expresses the author’s views and opinions. The information contained in this book is provided with- out any express, statutory, or implied warranties. Neither the authors, Microsoft Corporation, nor its resellers, or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book. Acquisitions Editor: Martin DelRe Project Editor: Melissa von Tschudi-Sutton Production: OTSI Body Part No. X11-89440 6-2244-2eBookFM.book Page iii Thursday, December 15, 2005 5:22 PM Contents at a Glance Part I The Basics of Advanced Windows Scripting 1 Getting Started. .3 2 Script Security. 41 Part II Packaging Your Scripts 3 Windows Script Files . 57 4 Windows Script Components. 95 5 HTML Applications: Scripts with a User Interface. 125 Part III The Basics of Advanced Windows Scripting 6 Remote Scripting . 161 7 Database Scripting. 179 8 Advanced ADSI and LDAP Scripting . 207 9 Using ADO and ADSI Together . 245 10 Advanced WMI Scripting . 261 11 WMI Events . 285 12 Better Scripting with WMI Tools . 319 13 Advanced Scripting in Windows XP and Windows Server 2003. 353 Part IV Scripting for the Enterprise 14 Group Policy Management Scripting . 393 15 Exchange 2003 Scripting. 425 16 Microsoft Operations Manager 2005 Scripting. 463 17 Virtual Server 2005 Scripting . 483 Part V Appendix Advanced Script Editor Features . 505 iii 6-2244-2eBookFM.book Page iv Thursday, December 15, 2005 5:22 PM iv Table of Contents 6-2244-2eBookFM.book Page v Thursday, December 15, 2005 5:22 PM Table of Contents Acknowledgements . xiii Introduction . .xv Part I The Basics of Advanced Windows Scripting 1 Getting Started. .3 Prerequisite Knowledge. 3 Understanding Windows Script Host Basics. 4 Using the FileSystemObject Library . 15 Understanding Arrays . 22 Understanding Active Directory Services Interface Fundamentals . 24 Understanding Windows Management Instrumentation Fundamentals . 29 Advanced Scripting Goals . 34 Securing Your Scripts . 34 Creating Your Own Script Components and Libraries . 34 Running Scripts Remotely . 35 Retrieving Information from Active Directory . 35 Manipulating Information Stored in a Database. 35 Managing Your Windows Environment with WMI Events . 35 Using New WMI Classes with Windows XP and Windows Server 2003 . 35 Managing Group Policy Objects with Scripting. 35 Managing Your Exchange 2003 Environment . 36 Incorporating Your Scripts into Microsoft Operations Manager . 36 Creating a Visual Interface for Your Script with Internet Explorer and . 36 HTML Applications (HTAs) What We Won’t Cover . 36 Finding Information about JScript, Perl, Python, and KiXtart . 37 The Right Tool for the Job. 38 Scripting Techniques . 39 Summary . 39 2 Script Security. 41 Script Encoding and Decoding. 41 v 6-2244-2eBookFM.book Page vi Thursday, December 15, 2005 5:22 PM vi Table of Contents Script Signing and the Windows Script Host TrustPolicy . 43 Understanding Digital Certificates and Script Signing . 43 Understanding WSH TrustPolicy . 46 Configuring WSH TrustPolicy in Your Environment . 47 Signing Scripts by Using a Digital Certificate . 49 Using Software Restriction Policies . 52 Alternate Credentials . 52 Using the RunAs Command . 52 Using Scheduled Tasks Credentials . 53 Using ADSI Alternate Credentials . 53 Using WMI Alternate Credentials . 54 Summary . 54 Part II Packaging Your Scripts 3 Windows Script Files . 57 Defining Windows Script Files . 57 Understanding XML. 58 The package Tag . 59 The comment Tag . 59 The job Tag . 59 The runtime Tag . 60 The description Tag . 60 The example Tag . 60 The named Tag . 61 The object Tag . 61 The script Tag . 62 Creating Script Jobs. 63 Including Other Scripts . 63 Adding Resources . ..
Recommended publications
  • Vbscript Programmer's Reference
    Table of Contents VBScript Programmer's Reference...................................................................................................................1 Introduction.........................................................................................................................................................6 Who is this Book For?............................................................................................................................6 How to Use this Book.............................................................................................................................6 What is VBScript?..................................................................................................................................7 What Can You Do With VBScript?......................................................................................................11 What Tools Do You Need to Use VBScript?.......................................................................................14 What's New in VBScript 5?..................................................................................................................15 Code Conventions.................................................................................................................................17 Tell Us What You Think.......................................................................................................................17 Customer Support.................................................................................................................................18
    [Show full text]
  • Operational and Administrative Guidance Microsoft Windows 10
    Operational and Administrative Guidance Microsoft Windows 10 and Windows Server Common Criteria Evaluation for Microsoft Windows 10 and Windows Server Version 1803 General Purpose Operating System Protection Profile © 2018 Microsoft Confidential. All rights reserved. Microsoft Windows 10 GP OS Administrative Guidance Copyright and disclaimer The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE INFORMATION IN THIS DOCUMENT. Complying with all applicable copyright laws is the responsibility of the user. This work is licensed under the Creative Commons Attribution-NoDerivs-NonCommercial VLicense (which allows redistribution of the work). To view a copy of this license, visithttp://creativecommons.org/licenses/by-nd-nc/1.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property. The example companies, organizations, products, people and events depicted herein are fictitious. No association with any real company, organization, product, person or event is intended or should be inferred.
    [Show full text]
  • Microsoft Windows Server 2019 Version 1809 Hyper-V
    Operational and Administrative Guidance Microsoft Windows Server, Microsoft Windows 10 version 1909 (November 2019 Update), Microsoft Windows Server 2019 version 1809 Hyper-V Common Criteria Evaluation under the Protection Profile for Virtualization, including the Extended Package for Server Virtualization Revision date: January 15, 2021 © 2021 Microsoft. All rights reserved. Microsoft Windows Server and Windows 10 Hyper-V Administrative Guidance Copyright and disclaimer The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE INFORMATION IN THIS DOCUMENT. Complying with all applicable copyright laws is the responsibility of the user. This work is licensed under the Creative Commons Attribution-NoDerivs-NonCommercial VLicense (which allows redistribution of the work). To view a copy of this license, visithttp://creativecommons.org/licenses/by-nd-nc/1.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property. The example companies, organizations, products, people and events depicted herein are fictitious.
    [Show full text]
  • Getting Started with Windows Scripting
    Getting Started with Windows Scripting art I of the PowerShell, VBScript, and JScript Bible intro- IN THIS PART duces you to the powerful administrative tool that is Windows scripting. You’ll get an overview of Windows Chapter 1 P Introducing Windows Scripting scripting and its potential, and an introduction to three tech- nologies you can use for Windows scripting: VBScript, JScript, Chapter 2 and PowerShell. VBScript Essentials Chapter 3 JScript Essentials Chapter 4 PowerShell Fundamentals COPYRIGHTED MATERIAL 886804c01.indd6804c01.indd 1 11/21/09/21/09 11:16:17:16:17 PPMM 86804c01.indd 2 1/21/09 1:16:18 PM Introducing Windows Scripting indows scripting gives everyday users and administrators the ability to automate repetitive tasks, complete activities while IN THIS CHAPTER away from the computer, and perform many other time-saving W Introducing Windows scripting activities. Windows scripting accomplishes all of this by enabling you to create tools to automate tasks that would otherwise be handled manually, Why script Windows? such as creating user accounts, generating log files, managing print queues, or examining system information. By eliminating manual processes, you Getting to know can double, triple, or even quadruple your productivity and become more Windows Script Host effective and efficient at your job. Best of all, scripts are easy to create and Understanding the Windows you can rapidly develop prototypes of applications, procedures, and utili- scripting architecture ties; and then enhance these prototypes to get exactly what you need, or just throw them away and begin again. This ease of use gives you the flex- ibility to create the kinds of tools you need without a lot of fuss.
    [Show full text]
  • IBM Connect:Direct for Microsoft Windows: Documentation Fixpack 1 (V6.1.0.1)
    IBM Connect:Direct for Microsoft Windows 6.1 Documentation IBM This edition applies to Version 5 Release 3 of IBM® Connect:Direct and to all subsequent releases and modifications until otherwise indicated in new editions. © Copyright International Business Machines Corporation 1993, 2018. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Chapter 1. Release Notes.......................................................................................1 Requirements...............................................................................................................................................1 Features and Enhancements....................................................................................................................... 2 Special Considerations................................................................................................................................ 3 Known Restrictions...................................................................................................................................... 4 Restrictions for Connect:Direct for Microsoft Windows........................................................................ 4 Restrictions for Related Software.......................................................................................................... 6 Installation Notes.........................................................................................................................................6
    [Show full text]
  • Tyson Kopczynski
    www.it-ebooks.info Tyson Kopczynski Windows® PowerShell UNLEASHED 800 East 96th Street, Indianapolis, Indiana 46240 USA www.it-ebooks.info Windows® PowerShell Unleashed Editor-in-Chief Copyright © 2007 by Sams Publishing Karen Gettman All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, Senior Acquisitions or otherwise, without written permission from the publisher. No patent liability is Editor assumed with respect to the use of the information contained herein. Although every Neil Rowe precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for Development Editor damages resulting from the use of the information contained herein. Mark Renfrow International Standard Book Number: 0-672-32953-0 Managing Editor Library of Congress Cataloging-in-Publication Data Gina Kanouse Kopczynski, Tyson. Project Editor Microsoft PowerShell unleashed / Tyson Kopczynski. George E. Nedeff p. cm. ISBN 0-672-32953-0 Copy Editor 1. Microsoft Windows (Computer file) 2. Operating systems (Computers) I. Title. Lisa M. Lord QA76.76.O63K66 2007 Senior Indexer 005.4’46—dc22 Cheryl Lenser 2007008894 Proofreader Printed in the United States of America Water Crest First Printing: Publishing 10090807 4321 Contributing Authors Trademarks Pete Handley, Mark All terms mentioned in this book that are known to be trademarks or service marks Weinhardt, and have been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the Josh Tolle validity of any trademark or service mark.
    [Show full text]
  • Case Study: Internet Explorer 1994..1997
    Case Study: Internet Explorer 1994..1997 Ben Slivka General Manager Windows UI [email protected] Internet Explorer Chronology 8/94 IE effort begins 12/94 License Spyglass Mosaic source code 7/95 IE 1.0 ships as Windows 95 feature 11/95 IE 2.0 ships 3/96 MS Professional Developer’s Conference AOL deal, Java license announced 8/96 IE 3.0 ships, wins all but PC Mag review 9/97 IE 4.0 ships, wins all the reviews IE Feature Chronology IE 1.0 (7/14/95) IE 2.0 (11/17/95) HTML 2.0 HTML Tables, other NS enhancements HTML <font face=> Cell background colors & images Progressive Rendering HTTP cookies (arthurbi) Windows Integration SSL Start.Run HTML (MS enhancements) Internet Shortcuts <marquee> Password Caching background sounds Auto Connect, in-line AVIs Disconnect Active VRML 1.0 Navigator parity MS innovation Feature Chronology - continued IE 3.0 (8/12/96) IE 3.0 - continued... IE 4.0 (9/12/97) Java Accessibility Dynamic HTML (W3C) HTML Frames PICS (W3C) Data Binding Floating frames HTML CSS (W3C) 2D positioning Componentized HTML <object> (W3C) Java JDK 1.1 ActiveX Scripting ActiveX Controls Explorer Bars JavaScript Code Download Active Setup VBScript Code Signing Active Channels MSHTML, SHDOCVW IEAK (corporations) CDF (XML) WININET, URLMON Internet Setup Wizard Security Zones DocObj hosting Referral Server Windows Integration Single Explorer ActiveDesktop™ Navigator parity MS innovation Quick Launch, … Wins for IE • Quality • CoolBar, Explorer Bars • Componetization • Great Mail/News Client • ActiveX Controls – Outlook Express – vs. Nav plug-ins
    [Show full text]
  • Spread for ASP.NET Developer's Guide
    Spread for ASP.NET Developer’s Guide 0 Developer's Guide This guide provides introductory conceptual material and how-to explanations for routine tasks for developers using Spread for ASP.NET. It describes how an application developer would use the properties and methods in Spread to create spreadsheets and grids on Web Forms, bind to databases, and customize the component for your application. Getting Started Understanding the Product Working with the Spread Designer Customizing the Appearance Customizing User Interaction Customizing with Cell Types Managing Data Binding Managing Data in the Component Managing Formulas Managing File Operations Using Sheet Models Maintaining State Working with the Chart Control Using Touch Support with the Component For complete API reference information, refer to the Assembly Reference (on-line documentation). For a complete list of documentation, refer to the Spread for ASP.NET Documentation (on-line documentation). Copyright © GrapeCity, inc. All rights reserved. Spread for ASP.NET Developer’s Guide 1 1 Table of Contents Developer's Guide 0 1. Table of Contents 1-16 Getting Started 17 Handling Installation 17 Installing the Product 17 Licensing a Trial Project after Installation 17 End-User License Agreement 17-18 Creating a Build License 18-19 Handling Redistribution 19-20 Product Requirements 20 Handling Variations In Windows Settings 20-21 Working with the Component 21 Adding a Component to a Web Site using Visual Studio 2015 or 2017 21-24 Adding a Component to a Web Site using Visual Studio 2013
    [Show full text]
  • Operational and Administrative Guidance
    Operational and Administrative Guidance Microsoft Windows Server, Microsoft Windows 10 version 1909 (November 2019 Update), Microsoft Windows Server 2019 version 1809 Hyper-V Common Criteria Evaluation under the Protection Profile for Virtualization, including the Extended Package for Server Virtualization Revision date: January 15, 2021 © 2021 Microsoft. All rights reserved. Microsoft Windows Server and Windows 10 Hyper-V Administrative Guidance Copyright and disclaimer The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE INFORMATION IN THIS DOCUMENT. Complying with all applicable copyright laws is the responsibility of the user. This work is licensed under the Creative Commons Attribution-NoDerivs-NonCommercial VLicense (which allows redistribution of the work). To view a copy of this license, visithttp://creativecommons.org/licenses/by-nd-nc/1.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property. The example companies, organizations, products, people and events depicted herein are fictitious.
    [Show full text]
  • Blocked Attachments in Outlook Page 1 of 5
    Blocked attachments in Outlook Page 1 of 5 Outlook > Attachments Blocked attachments in Outlook To help protect your computer, Microsoft Office Outlook does not allow you to receive files of certain types (such as .exe files) as attachments, because of their potential for introducing a virus into your computer. Outlook blocks these files by default. If your organization uses Microsoft Exchange, only the e-mail server administrator can unblock these file types. End users of Outlook cannot unblock these file types. In this article Background - The Internet is a dangerous neighborhood How to share your files safely Attachment file types blocked by Outlook Background - The Internet is a dangerous neighborhood When Microsoft Outlook 97 first arrived on the market, the Internet still seemed like a relatively safe place, and sending attachments in e-mail seemed like a great idea. But then — beginning in March of 1999 when the Melissa virus struck, only to be followed by the ILOVEYOU virus — reality hit hard. These were the fastest-spreading viruses ever seen up to that time, and they forced a number of companies to shut down their e-mail systems, at significant cost. In order to spread, these attacks relied heavily on fooling people into believing that infected e-mail messages were coming from someone familiar, and even many computer experts fell victim to them and became infected. It is no secret that hackers like to attack the largest available target — and today, that is Microsoft Office Outlook. World wide, more than 300 million people use Outlook. Therefore, the industry and Microsoft customers look to Microsoft to provide protection against security threats.
    [Show full text]
  • Net Use User Password Example
    Net Use User Password Example Jerold often mutualised contradictively when remissible Luce ensanguines severely and dissolvings her avarices. Abdul often conquers scot-free when drilled Everard underplays yesterday and antes her serialism. Passional and goosy Johnnie fine his stinkstone concentrated knob dissipatedly. This net logon service enabled in us say you might be edited in email. Nasa show you need put in exploitation such as a category, if one yourself too large for example of your trusted domains. Actually somehow use some use with user password and share unit to account the share1. How it connects manually disconnect. Example if we blow to map drive letter U to incorporate share uscprojects we'd. The passwords in between those commands below you might see more options below are two lines that when their respective windows. Infrastructure PenTest Series Part 3 Exploitation tech. MS-DOS and Windows command line net command. For example include following entries are equivalent if entered between Jan. Windows mapped drives what the hell is strain on. How to map network part from command line. Thank you get when net send us in. Use eDirectory identifier variable in login script NET USE. This code will be loaded when they are some examples how it maps my previous example of. Smbclient U user L 192161122 Enter SAMBAuser's password Sharename Type Comment -------- --- ------ print Disk. Make sure them you have his guest user account password before mounting the. Net commandUser Wikiversity. How can register change my user-account password from a Command Prompt. Net net I httpsCBDBcenterbasecomfilesystem USERPASSWORD. You use free Net Continue command to restart a service loss has been paused by what Net.
    [Show full text]
  • Windows® Scripting Secrets®
    4684-8 FM.f.qc 3/3/00 1:06 PM Page i ® WindowsSecrets® Scripting 4684-8 FM.f.qc 3/3/00 1:06 PM Page ii 4684-8 FM.f.qc 3/3/00 1:06 PM Page iii ® WindowsSecrets® Scripting Tobias Weltner Windows® Scripting Secrets® IDG Books Worldwide, Inc. An International Data Group Company Foster City, CA ♦ Chicago, IL ♦ Indianapolis, IN ♦ New York, NY 4684-8 FM.f.qc 3/3/00 1:06 PM Page iv Published by department at 800-762-2974. For reseller information, IDG Books Worldwide, Inc. including discounts and premium sales, please call our An International Data Group Company Reseller Customer Service department at 800-434-3422. 919 E. Hillsdale Blvd., Suite 400 For information on where to purchase IDG Books Foster City, CA 94404 Worldwide’s books outside the U.S., please contact our www.idgbooks.com (IDG Books Worldwide Web site) International Sales department at 317-596-5530 or fax Copyright © 2000 IDG Books Worldwide, Inc. All rights 317-572-4002. reserved. No part of this book, including interior design, For consumer information on foreign language cover design, and icons, may be reproduced or transmitted translations, please contact our Customer Service in any form, by any means (electronic, photocopying, department at 800-434-3422, fax 317-572-4002, or e-mail recording, or otherwise) without the prior written [email protected]. permission of the publisher. For information on licensing foreign or domestic rights, ISBN: 0-7645-4684-8 please phone +1-650-653-7098. Printed in the United States of America For sales inquiries and special prices for bulk quantities, 10 9 8 7 6 5 4 3 2 1 please contact our Order Services department at 1B/RT/QU/QQ/FC 800-434-3422 or write to the address above.
    [Show full text]