Chapter 28. Library: Network Resource Utilities

The network resource library provides functions for working with drives, network shares, services, open resources, and user sessions. The sections that follow show the source for the script, as well as how the script can be used.

Examining the Network Resource Utility Library

Listing 28-1 shows the source code for the network resource library. Key features implemented in this library are discussed in Chapters 10, 18 and 19.

Example 28.1. Managing Network Resources

netreslib.js
// ************************
// Script: Network Resource Library
// Version: 1.1.8
// Creation Date: 04/30/2008
// Last Modified: 05/15/2008
// Author: William R. Stanek
// Email: williamstanek@aol.com
// ************************
// Description: Provides a utility library for
//              managing network resources.
// ************************
// Copyright (c) 2008 William R. Stanek // You have a royalty-free right to use these applications, provided // that you give credit to the author AND agree that the author has // no warranty, obligations or liability for any of these library // functions. // ************************ function GetDriveInfo() { var fs, d, e, s, t, wnet, cname; wNet = WScript.CreateObject("WScript.Network"); cname = wNet.ComputerName; fs = new ActiveXObject ("Scripting.FileSystemObject"); e = new Enumerator(fs.Drives); s = ""; s += "=========================" ...

Get Microsoft® PowerShell, VBScript and JScript® Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.