Book description
Packed with more than 300 sample scripts and an extensive collection of library functions, this essential scripting book is the most thorough guide to Windows scripting and PowerShell on the market. You’ll examine how Windows scripting is changing the face of system and network administration by giving everyday users, developers, and administrators the ability to automate repetitive tasks. Plus, this is the first time that VBScript, Jscript, and Powershell are all covered in a single resource.
Table of contents
- Copyright
- About the Authors
- About the Technical Editor
- Credits
- Acknowledgments
- Introduction
-
I. Getting Started with Windows Scripting
- 1. Introducing Windows Scripting
- 2. VBScript Essentials
- 3. JScript Essentials
-
4. PowerShell Fundamentals
- 4.1. Shell Fundamentals
- 4.2. PowerShell Aliases
- 4.3. Cmdlets, Snap-ins, and Providers
- 4.4. Functions and Filters
- 4.5. Objects and Types and the PowerShell Pipe
- 4.6. Exploring PowerShell Variables
- 4.7. Richer Types and .NET Objects
- 4.8. Arrays
- 4.9. The PowerShell Pipe
- 4.10. Looping in PowerShell
- 4.11. Conditions
- 4.12. Scripts, Script Blocks, and Functions
- 4.13. Scripts and Security
- 4.14. Summary
-
II. Windows VBScript and JScript
- 5. Creating Scripts and Scripting Files
- 6. VBScript and JScript Scripting Basics
- 7. Input, Output, and Error Handling with VBScript and JScript
-
8. Working with Files and Folders in VBScript and JScript
- 8.1. Understanding the FileSystemObject
- 8.2. Working with Folders
- 8.3. Using Special Folders
- 8.4. Working with Files
- 8.5. Summary
- 9. Reading and Writing Files
- 10. Managing Drives and Printers with VBScript and JScript
-
11. Configuring Menus, Shortcuts, and Startup Applications
- 11.1. Working with Menus, Desktops, and Startup Applications
- 11.2. Creating Shortcuts and Menu Options
- 11.3. Managing Shortcuts and Menus
- 11.4. Adding and Removing Startup Applications
- 11.5. Summary
-
12. Working with the Windows Registry and Event Logs
- 12.1. Working with the Windows Registry
- 12.2. Using Event Logs
- 12.3. Writing to Event Logs
- 12.4. Reading Event Logs
- 12.5. Generating Event Log Reports
- 12.6. Summary
-
III. Network and Dictionary Service Scripting
- 13. Scheduling One-time and Recurring Tasks
- 14. Managing Computer and User Scripts
- 15. Introducing Active Directory Services Interfaces
- 16. Using Schema to Master ADSI
-
17. Managing Local and Domain Resources with ADSI
- 17.1. Managing Domain Account Policies
- 17.2. Working with Local Computer Properties
- 17.3. Creating and Modifying User Accounts
- 17.4. Creating and Modifying Group Accounts
- 17.5. Summary
- 18. Service and Resource Administration with ADSI
- 19. Maintaining Shared Directories, Printer Queues, and Print Jobs
- 20. Managing Active Directory Domain Extensions
-
IV. Windows PowerShell
-
21. Input, Output, and Error Handling in PowerShell
- 21.1. Output to the Console
- 21.2. A Little Diversion into Strings
- 21.3. Implicit and Explicit Output
- 21.4. Verbose and Debug Output
- 21.5. Managing Different Outputs from Cmdlets
- 21.6. More on Error Output
- 21.7. Session Transcripts
- 21.8. Tracking Progress
- 21.9. Taking More Control of Formatting
- 21.10. Sorting and Selecting Fields
- 21.11. Changing How PowerShell Formats Objects
- 21.12. Creating Custom Objects on Demand
- 21.13. Techniques for Switching in Output
- 21.14. Additional Output Cmdlets
- 21.15. Outputting in Specific File Formats
- 21.16. Every Export Has a Corresponding Import
- 21.17. More on Selecting Text
- 21.18. User Input
- 21.19. Summary
-
22. Working with Files and the Registry in PowerShell
-
22.1. Using PSDrives, Accessing the File System, Mapping Drives
- 22.1.1. Changing (setting) locations
- 22.1.2. Getting child items (a.k.a. getting a directory) and testing paths
- 22.1.3. Copying, deleting and renaming files
- 22.1.4. Creating and deleting directories
- 22.1.5. File properties and attributes
- 22.1.6. Viewing and setting ACL permissions
- 22.1.7. Working with file items: reading their content, creating and adding to them
- 22.1.8. Selecting strings and working with text data
- 22.1.9. Parsing text
- 22.1.10. Working with the Registry
- 22.2. Summary
-
22.1. Using PSDrives, Accessing the File System, Mapping Drives
- 23. Event Logging, Services, and Process Monitoring with PowerShell
-
24. Working with Active Directory Using ADSI and PowerShell
- 24.1. A Quick Introduction to Active Directory
- 24.2. Getting Entries from AD with [ADSI]
- 24.3. Creating Objects
- 24.4. Getting Directory Entries with the Searcher
- 24.5. Operations on Directory Entries
- 24.6. Summary
- 25. Working with WMI in PowerShell
-
21. Input, Output, and Error Handling in PowerShell
-
V. Windows Scripting Libraries
-
26. Library: File-System Utilities
- 26.1. Examining the File-System Utility Library
-
26.2. Using the File-System Utility Library
- 26.2.1. Using GetSubFolders, GetFiles, and GetFolderContents
- 26.2.2. Using CheckExists
- 26.2.3. Using GetInfo, GetSize, and GetType
- 26.2.4. Setting and clearing file attributes
- 26.2.5. Working with special folders, shortcuts, and menus
- 26.2.6. Managing menu options
- 26.2.7. Adding to the desktop and Start menu
- 26.2.8. Using NewFolder and NewFile
- 26.2.9. Using DeleteFile, DeleteFolder, and DeleteShortcut
- 26.3. Summary
- 27. Library: I/O Utilities
- 28. Library: Network Resource Utilities
- 29. Library: Account Management Utilities
-
30. Library: Building a PowerShell Library
- 30.1. Customizing Your PowerShell Environment
- 30.2. A Generic "choose" Function
- 30.3. Network Utilities
- 30.4. Clever Uses for Hash Tables
- 30.5. COM Objects: A Firewall Tool
- 30.6. Using .NET Objects to Access Mail and Web Services
- 30.7. Regular Expressions
- 30.8. More Advanced Text Processing—Discovering Script Dependencies
- 30.9. Scripts or Fuctions: Checking How a Script Was Invoked
- 30.10. Summary
-
26. Library: File-System Utilities
-
VI. Appendixes
-
A. Windows Scripting API
- A.1. XML Elements
- A.2. getResource Static Method
- A.3. Drives Collection
- A.4. Printers Collection
- A.5. StdIn Stream*
- A.6. StdErr Stream*
- A.7. StdOut Stream*
- A.8. WshArguments Collection
- A.9. WshNamed Collection
- A.10. WshUnnamed Collection
- A.11. Script.Signer Object
- A.12. WScript Object
- A.13. WshController Object
- A.14. WshEnvironment Object
- A.15. WshNetwork Object
- A.16. WshRemote Object
- A.17. WshRemoteError Object
- A.18. WshScriptExec Object
- A.19. WshShell Object
- A.20. WshShortcut Object
- A.21. WshSpecialFolders Object
- A.22. WshUrlShortcut Object
-
B. Core ADSI Reference
- B.1. Using This Reference
-
B.2. ADSI Interfaces
- B.2.1. IADs
- B.2.2. IADsAcl
- B.2.3. IADsADSystemInfo
- B.2.4. IADsBackLink
- B.2.5. IADsCaseIgnoreList
-
B.2.6. IADsClass
-
B.2.6.1. Properties
- B.2.6.1.1. Abstract
- B.2.6.1.2. AuxDerivedFrom
- B.2.6.1.3. Auxiliary
- B.2.6.1.4. CLSID
- B.2.6.1.5. Container
- B.2.6.1.6. Containment
- B.2.6.1.7. DerivedFrom
- B.2.6.1.8. HelpFileContext
- B.2.6.1.9. HelpFileName
- B.2.6.1.10. MandatoryProperties
- B.2.6.1.11. NamingProperties
- B.2.6.1.12. OID
- B.2.6.1.13. OptionalProperties
- B.2.6.1.14. PossibleSuperiors
- B.2.6.1.15. PrimaryInterface
- B.2.6.2. Method
-
B.2.6.1. Properties
- B.2.7. IADsCollection
-
B.2.8. IADsComputer
-
B.2.8.1. Properties
- B.2.8.1.1. ComputerID
- B.2.8.1.2. Department
- B.2.8.1.3. Description
- B.2.8.1.4. Division
- B.2.8.1.5. Location
- B.2.8.1.6. MemorySize
- B.2.8.1.7. Model
- B.2.8.1.8. NetAddresses
- B.2.8.1.9. OperatingSystem
- B.2.8.1.10. OperatingSystemVersion
- B.2.8.1.11. Owner
- B.2.8.1.12. PrimaryUser
- B.2.8.1.13. Processor
- B.2.8.1.14. ProcessorCount
- B.2.8.1.15. Role
- B.2.8.1.16. Site
- B.2.8.1.17. StorageCapacity
-
B.2.8.1. Properties
- B.2.9. IADsComputerOperations
- B.2.10. IADsContainer
- B.2.11. IADsDeleteOps
- B.2.12. IADsDomain
- B.2.13. IADsEmail
- B.2.14. IADsExtension
- B.2.15. IADsFaxNumber
- B.2.16. IADsFileService
- B.2.17. IADsFileServiceOperations
- B.2.18. IADsFileShare
- B.2.19. IADsGroup
- B.2.20. IADsHold
- B.2.21. IADsLargeInteger
- B.2.22. IADsLocality
- B.2.23. IADsMembers
- B.2.24. IADsNamespaces
- B.2.25. IADsNetAddress
- B.2.26. IADsO
- B.2.27. IADsObjectOptions
- B.2.28. IADsOctetList
- B.2.29. IADsOpenDSObject
- B.2.30. IADsOU
- B.2.31. IADsPath
-
B.2.32. IADsPathname
- B.2.32.1. Property
-
B.2.32.2. Methods
- B.2.32.2.1. AddLeafElement("leafElement")
- B.2.32.2.2. CopyPath()
- B.2.32.2.3. GetElement(index)
- B.2.32.2.4. GetEscapedElement(number,stringToEscape)
- B.2.32.2.5. GetNumElements()
- B.2.32.2.6. RemoveLeafElement()
- B.2.32.2.7. Retrieve(formatType)
- B.2.32.2.8. Set("AdsPath",optionType)
- B.2.32.2.9. SetDisplayType(displayType)
- B.2.33. IADsPostalAddress
- B.2.34. IADsPrintJob
- B.2.35. IADsPrintJobOperations
-
B.2.36. IADsPrintQueue
-
B.2.36.1. Properties
- B.2.36.1.1. BannerPage
- B.2.36.1.2. Datatype
- B.2.36.1.3. DefaultJobPriority
- B.2.36.1.4. Description
- B.2.36.1.5. Location
- B.2.36.1.6. Model
- B.2.36.1.7. NetAddresses
- B.2.36.1.8. PrintDevices
- B.2.36.1.9. PrinterPath
- B.2.36.1.10. PrintProcessor
- B.2.36.1.11. Priority
- B.2.36.1.12. StartTime
- B.2.36.1.13. UntilTime
-
B.2.36.1. Properties
- B.2.37. IADsPrintQueueOperations
- B.2.38. IADsProperty
- B.2.39. IADsPropertyEntry
- B.2.40. IADsPropertyList
- B.2.41. IADsPropertyValue
- B.2.42. IADsPropertyValue2
- B.2.43. IADsReplicaPointer
- B.2.44. IADsResource
- B.2.45. IADsSession
-
B.2.46. IADsService
-
B.2.46.1. Properties
- B.2.46.1.1. Dependencies
- B.2.46.1.2. DisplayName
- B.2.46.1.3. ErrorControl
- B.2.46.1.4. HostComputer
- B.2.46.1.5. LoadOrderGroup
- B.2.46.1.6. Path
- B.2.46.1.7. ServiceAccountName
- B.2.46.1.8. ServiceAccountPath
- B.2.46.1.9. ServiceType
- B.2.46.1.10. StartType
- B.2.46.1.11. StartupParameters
- B.2.46.1.12. Version
-
B.2.46.1. Properties
- B.2.47. IADsServiceOperations
- B.2.48. IADsSyntax
- B.2.49. IADsTimestamp
- B.2.50. IADsTypedName
-
B.2.51. IADsUser
-
B.2.51.1. Properties
- B.2.51.1.1. AccountDisabled
- B.2.51.1.2. AccountExpirationDate
- B.2.51.1.3. BadLoginAddress
- B.2.51.1.4. BadLoginCount
- B.2.51.1.5. Department
- B.2.51.1.6. Description
- B.2.51.1.7. Division
- B.2.51.1.8. EmailAddress
- B.2.51.1.9. EmployeeID
- B.2.51.1.10. FaxNumber
- B.2.51.1.11. FirstName
- B.2.51.1.12. FullName
- B.2.51.1.13. GraceLoginsAllowed
- B.2.51.1.14. GraceLoginsRemaining
- B.2.51.1.15. HomeDirectory
- B.2.51.1.16. HomePage
- B.2.51.1.17. IsAccountLocked
- B.2.51.1.18. Languages
- B.2.51.1.19. LastFailedLogin
- B.2.51.1.20. LastLogin
- B.2.51.1.21. LastLogoff
- B.2.51.1.22. LastName
- B.2.51.1.23. LoginHours
- B.2.51.1.24. LoginScript
- B.2.51.1.25. LoginWorkstations
- B.2.51.1.26. Manager
- B.2.51.1.27. MaxLogins
- B.2.51.1.28. MaxStorage
- B.2.51.1.29. NamePrefix
- B.2.51.1.30. NameSuffix
- B.2.51.1.31. OfficeLocations
- B.2.51.1.32. OtherName
- B.2.51.1.33. PasswordExpirationDate
- B.2.51.1.34. PasswordLastChanged
- B.2.51.1.35. PasswordMinimumLength
- B.2.51.1.36. PasswordRequired
- B.2.51.1.37. Picture
- B.2.51.1.38. PostalAddresses
- B.2.51.1.39. PostalCodes
- B.2.51.1.40. Profile
- B.2.51.1.41. RequireUniquePassword
- B.2.51.1.42. SeeAlso
- B.2.51.1.43. TelephoneHome
- B.2.51.1.44. TelephoneMobile
- B.2.51.1.45. TelephoneNumber
- B.2.51.1.46. TelephonePager
- B.2.51.1.47. Title
- B.2.51.2. Methods
-
B.2.51.1. Properties
- B.2.52. IDirectoryObject
- B.2.53. IDirectorySearch
- B.3. ADSI Error Codes
-
C. Essential Command-Line Utilities for Use with WSH
- C.1. ARP
- C.2. ASSOC
- C.3. AT
- C.4. ATTRIB
- C.5. CACLS
- C.6. CHKDSK
- C.7. COMPACT
- C.8. CONVERT
- C.9. DATE
- C.10. DRIVERQUERY
- C.11. EXPAND
- C.12. FC
- C.13. FORMAT
- C.14. FTP
- C.15. FTYPE
- C.16. IPCONFIG
- C.17. NBTSTAT
- C.18. NET ACCOUNTS
- C.19. NET COMPUTER
- C.20. NET CONFIG SERVER
- C.21. NET CONFIG WORKSTATION
- C.22. NET CONTINUE
- C.23. NET FILE
- C.24. NET GROUP
- C.25. NET LOCALGROUP
- C.26. NET PAUSE
- C.27. NET PRINT
- C.28. NET SESSION
- C.29. NET SHARE
- C.30. NET START
- C.31. NET STATISTICS
- C.32. NET STOP
- C.33. NET TIME
- C.34. NET USE
- C.35. NET USER
- C.36. NET VIEW
- C.37. NETSTAT
- C.38. NSLOOKUP
- C.39. PATH
- C.40. PING
- C.41. RECOVER
- C.42. ROUTE
- C.43. SCHTASKS
- C.44. TIME
- C.45. TRACERT
-
A. Windows Scripting API
Product information
- Title: Microsoft® PowerShell, VBScript and JScript® Bible
- Author(s):
- Release date: February 2009
- Publisher(s): Wiley
- ISBN: 9780470386804
You might also like
book
Cybersecurity Blue Team Toolkit
A practical handbook to cybersecurity for both tech and non-tech professionals As reports of major data …
book
Effective C
The world runs on code written in the C programming language, yet most schools begin the …
video
CCNA 200-301
More Than 16 Hours of Video Instruction Overview CCNA 200-301 Complete Video Course is a comprehensive …
book
Practical Malware Analysis
For those who want to stay ahead of the latest malware, Practical Malware Analysis will teach …