Are you aware of a resource from which I can learn about all the new Window Script Host (WSH), Active Directory Service Interfaces (ADSI), and Windows Management Instrumentation (WMI) scripting features in Windows Server 2003?
Great question. Unfortunately, I'm unaware of a resource that covers all the additions and changes to WSH, ADSI, and WMI. However, if you're willing to dig a little, you can find a lot of what you're looking for in a variety of locations on Microsoft's Web site. The following pointers and tips should help you get started.
WSH. Windows 2003 includes WSH 5.6, the same version that shipped with Windows XP—well, almost. To be completely accurate, Windows 2003 ships with a more recent build of WSH 5.6. XP shipped with WSH 220.127.116.1126, whereas Windows 2003 ships with WSH 18.104.22.16815. The primary difference between the two is that WSH 22.214.171.12415 includes bug fixes that WSH 126.96.36.19926 doesn't include, which is why you'll find a WSH 5.6 download available for XP on the Microsoft Windows Script Downloads Web site (http://msdn.microsoft.com/library/default.asp?url=/downloads/list/webdev.asp). The Windows Script 5.6 download for XP and Windows 2000 updates the two platforms to the same build of WSH included with Windows 2003.
WSH 5.6 remains unchanged featurewise. To learn more about WSH 5.6, I recommend the following resources:
- "WSH Primer" in the Microsoft Windows 2000 Scripting Guide (http://www.microsoft.com/technet/scriptcenter/scrguide/sas_wsh_overview.asp)
- Windows Script Host Documentation (http://msdn.microsoft.com/scripting)
ADSI. ADSI remains largely unchanged with two notable exceptions. First, you no longer need to worry about canonical form—that is, the correct order of deny access control entries (ACEs) in an ACL—because ADSI correctly orders ACEs when you modify or update Security Descriptors (SDs). Second, ADSI includes a new security interface named IADsSecurityUtility, which lets you use ADSI to manage file, folder, registry, and share permissions. The IADsSecurityUtility interface replaces the IADsSecurity interface, which earlier versions of the ADSI software development kit (SDK) included. At the time of this writing, using IADsSecurityUtility to modify registry permissions doesn't work because of a bug. However, you can use IADsSecurityUtility to read registry permissions.
Both ADSI enhancements are also part of XP. To learn more about these ADSI enhancements, check out "TechNet Webcast: What's New in Scripting for Windows 2003?" (http://www.microsoft.com/usa/webcasts/ondemand/1809.asp).
WMI. WMI is a biggie in terms of the extent of changes in Windows 2003. WMI includes four new scripting objects in the WMI Scripting Library, many new WMI providers, and hundreds of new and improved WMI classes.
The four new scripting objects in the WMI Scripting Library are SWbemServicesEx, SWbemObjectEx, SWbemDateTime, and SWbemRefresher. SWbemServicesEx and SWbemObjectEx are extensions to the existing objects named SWbemServices and SWbemObject, respectively, and provide additional functionality, such as XML support. SWbemDateTime is a helper object that makes working with CIM_DATETIME values much simpler. SWbemRefresher provides an easy way to refresh data obtained from instances of WMI managed resources. To learn more about the new objects in the WMI Scripting Library, see the Scripting API Objects Web page in the WMI SDK (http://msdn.microsoft.com/library/en-us/wmisdk/wmi/scripting_api_objects.asp).
Some of the new WMI providers include the following:
- Cooked Performance Counter Provider
- DFS Provider
- Disk Quota Provider
- DNS Provider
- Internet Information Services (IIS) Provider
- IP Route Provider
- Job Object Provider
- Network Load Balancing Provider
- Ping Provider
- Policy Provider
- Power Management Event Provider
- Server Cluster Provider
- Shadow Copy Provider
- Storage Volume Provider
- Terminal Services Provider
- Trustmon Provider
- Windows Product Activation Provider
To learn more about a specific WMI provider, including its namespace, classes, methods, and properties, the best advice I can offer is to search for the provider's name in the online Microsoft Developer Network (MSDN) Library (http://msdn.microsoft.com/library). The WMI Providers Web page in the WMI SDK (http://msdn.microsoft.com/library/en-us/wmisdk/wmi/wmi_providers.asp) also includes links to the documentation for many of the providers I just listed.
Windows 2003 has too many new and updated WMI classes to list here. However, the Win32 Classes Web page in the WMI SDK (http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_classes.asp) makes a good attempt at categorizing WMI classes into component and resource buckets, and identifying the minimum system requirements for each. Although using Scriptomatic 2.0 or another tool to browse and familiarize yourself with the WMI namespaces and their classes might not be the most efficient use of your time, I do think the exercise is valuable.
Windows 2003 includes many additional scripting goodies outside of those found in WSH, ADSI, and WMI. For example, the new scriptpw.dll component provides an easy way to retrieve a password from STDIN without echoing the password to the console. The new cmdlib.wsc component provides the handy ShowResults method, which you can use to format output. Windows 2003 also offers new command-line tools, such as the six new directory service (DS) command-line tools (i.e., dsadd.exe, dsget.exe, dsmod.exe, dsquery.exe, dsmove.exe, and dsrm.exe) and new add-on scripting solutions, such as the new Group Policy Management Console (GPMC), which is fully scriptable. Suffice to say, Windows 2003 offers enough new and updated scripting tools to learn about to keep us all busy well into the future.