Advanced VBScript for Microsoft Windows Administrators Don Jones instant download
Advanced VBScript for Microsoft Windows Administrators Don Jones instant download
https://ebookfinal.com/download/advanced-vbscript-for-microsoft-
windows-administrators-don-jones/
https://ebookfinal.com/download/windows-powershell-v1-0-tfm-2nd-
edition-don-jones/
https://ebookfinal.com/download/microsoft-outlook-2007-programming-
jumpstart-for-power-users-and-administrators-sue-mosher/
https://ebookfinal.com/download/microsoft-wsh-and-vbscript-
programming-for-the-absolute-beginner-2nd-edition-jr-jerry-lee-ford/
https://ebookfinal.com/download/windows-forensic-analysis-toolkit-
advanced-analysis-techniques-for-windows-8-4th-edition-harlan-carvey-
auth/
Microsoft Windows Vista Visual Encyclopedia Kate Shoup
https://ebookfinal.com/download/microsoft-windows-vista-visual-
encyclopedia-kate-shoup/
https://ebookfinal.com/download/be-the-master-4th-edition-don-jones/
https://ebookfinal.com/download/hacking-exposed-windows-microsoft-
windows-security-secrets-and-solutions-third-edition-joel-scambray/
https://ebookfinal.com/download/microsoft-windows-registry-guide-2nd-
edition-jerry-honeycutt/
https://ebookfinal.com/download/how-microsoft-windows-vista-works-1st-
edition-michael-miller/
Advanced VBScript for Microsoft Windows
Administrators Don Jones Digital Instant Download
Author(s): Don Jones, Jeffery Hicks
ISBN(s): 9780735622449, 0735622442
Edition: Kindle
File Details: PDF, 8.15 MB
Year: 2006
Language: english
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
1 2 3 4 5 6 7 8 9 QWT 9 8 7 6 5
Contents at a Glance
Part I The Basics of Advanced Windows Scripting
1 Getting Started. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
2 Script Security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
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
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
Table of Contents ix
x Table of Contents
Table of Contents xi
Part V Appendix
Advanced Script Editor Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
6-2244-2eBookFM.book Page xiii Thursday, December 15, 2005 5:22 PM
Acknowledgements
I’d like to thank Jeffery, who has easily been one of the best co-authors anyone could ask for.
Writing a book can be exceedingly stressful and time-consuming, and a good co-author can
really help alleviate a lot of that. Thanks also go out to everyone at SAPIEN Technologies:
Jonathan, Alex, and Ferdinand, who provided assistance with tools and technologies that
were ancillary to the book’s main purpose, making things much smoother. Finally, a big cheer
is due all the users at ScriptingAnswers.com, whose persistence and unwavering support of
the scripting community were a primary motivation for bringing this book to market.
Don Jones
Las Vegas, NV
Writing your first book can be a daunting and sometimes frightening task. Fortunately, I had
a great writing partner. Thanks, Don, for being such a terrific guide in the strange new world
of publishing. Thanks, too, to the people at Visory Group. I truly appreciate the flexibility you
give me to take on projects like this one. Finally, I want to say an extra big thank-you to Beth,
Lucas, and Ellie. Without the love, support, and understanding of my new family (“Daddy has
to work again tonight?”), I would never have made it this far. You’re the reason I work so hard.
Jeffery Hicks
Syracuse, NY
xiii
6-2244-2eBookFM.book Page xiv Thursday, December 15, 2005 5:22 PM
6-2244-2eBookFM.book Page xv Thursday, December 15, 2005 5:22 PM
Introduction
When writing my first scripting book, Managing Windows with VBScript and WMI (Addison-
Wesley, 2004), I set out to create what was at the time an industry first: a book designed not
for developers but specifically for Microsoft Windows administrators with very little VBScript
experience who wanted to learn just enough VBScript to be effective. Since that book was
published, Windows administrators have become more and more skilled with Windows
Script Host, VBScript, Windows Management Instrumentation, and other related technolo-
gies. Because administrators attending conferences and viewing my Web site (http://
www.ScriptingAnswers.com) are beginning to ask questions about more complex technologies
and techniques, the time has come for a book that covers advanced topics.
In this book, my able co-author, Jeffery Hicks, and I try to cover some of the more advanced
scripting techniques that we use every day. We certainly aren’t pretending that we touch on
every topic that might be considered “advanced”; after all, scripting is as varied and complex
as Microsoft Windows itself. Instead, we try to cover the most useful advanced technologies,
recognizing that our fellow administrators are typically as practical and pragmatic as we are.
We also try to cover these technologies in much the same way that we learned about them,
by presenting complete solutions and line-by-line walkthroughs, so that you can see the final
product as well as a detailed description of how and why it works.
Personally, I’m delighted that Windows is now such a mature, stable product that we have the
time and tools to explore automation through scripting. I’m also glad that more administra-
tors are tackling advanced topics, which tells me that Windows has truly become an enter-
prise operating system, with the level of complexity and scriptability often associated with
traditional enterprise-class operating systems such as UNIX.
Jeffery and I both appreciate that you’ve selected this book for your further scripting educa-
tion. We certainly hope you find it useful! That said, we want to offer a brief word of caution:
This is truly an advanced book. We don’t take the time to explain basic scripting concepts,
and we assume that you already have medium- to high-level scripting skills. We do cover a few
basics at the beginning of the book, but only to provide a quick refresher of techniques you
might not use every day.
With that caveat out of the way, I want to wish you the best of luck with your scripting efforts!
Don Jones
xv
6-2244-2eBookFM.book Page xvi Thursday, December 15, 2005 5:22 PM
xvi Introduction
System Requirements
To use the Advanced VBScript for Microsoft Windows Administrators companion CD, you’ll need
a computer equipped with the following configuration:
Introduction xvii
■ Some scripts—notably the ones dealing with Microsoft Exchange Server 2003, Microsoft
Virtual Server 2005, or Microsoft Operations Manager 2005—require additional
Microsoft products, as appropriate.
■ Microsoft Internet Explorer 5.5 or later.
■ Adobe Acrobat or Acrobat Reader.
Do take a few moments to explore the CD and all it contains. If you’d like to pursue scripting
beyond the topics included in this book, we invite you to visit Don’s Web site at http://
www.ScriptingAnswers.com. You’ll find additional script samples, training, discussion forums for
questions and answers, and more resources, all designed for Windows administrative scripting.
http://www.microsoft.com/learning/support/books
To search for book and CD corrections for this book by using the book’s ISBN, go to
http://www.microsoft.com/mspress/support/search.asp
If you have comments, questions, or ideas regarding this book or the companion CD, please
send them to Microsoft Press using either of the following methods:
E-Mail: mspinput@microsoft.com
Postal Mail:
Microsoft Press
Attn: Advanced VBScript for Microsoft Windows Administrators project editor
One Microsoft Way
Redmond, WA 98052
Please note that Microsoft software product support is not offered through the above addresses.
6-2244-2eBookFM.book Page xviii Thursday, December 15, 2005 5:22 PM
Amidst this work of reform, the Parliament suddenly lost its firmest
support.
The Black Prince died on the 8th of June, 1376. For a long time he
had been ailing, and unable to assume in the government of his
country the position which by right belonged to him; but the nation
had always reckoned upon his wisdom and justice no less than on
his brilliant valor; a prosperous and happy reign had been hoped
for, and the grief was general and protracted. "The good fortune of
England seemed bound up in his person," says the chronicler
Walsingham; "it had flourished in his health, it languished in his
illness, and died at his death; in him expired all the hopes of the
English. For during his lifetime neither an invasion of the enemy nor
an encounter in battle had been feared." He was interred with
great pomp in Canterbury Cathedral, where he had formerly
erected a chapel in memory of his marriage. At the especial request
of Parliament, his eldest son Richard was thereupon declared heir
to the throne. Fears were entertained concerning the pretensions of
the Duke of Lancaster, who had resumed all his authority. Sir Peter
de la Mare, who had impeached the ministers in the name of
Parliament, was arrested. The Bishop of Winchester, William of
Wykeham, formerly at the head of the opposition, was divested of
his revenues. A Parliament favorable to John of Gaunt was
convoked; it proposed the recall of Alice Perrers, the rehabilitation
of Lord Latimer, and other measures so unpopular that the palace
of the duke was assailed by the citizens of London, and his friend
Lord Percy, a Marshal of England, was pursued by the mob, so that
the prince was obliged to throw himself into a small boat with
Percy, and take refuge at Kennington, in the castle inhabited by the
young Prince Richard and his mother. All the remonstrances of the
Bishop of London scarcely succeeded in calming the disturbance.
The arms of the Duke of Lancaster, at the gate of his palace, were
inverted by the people as the escutcheon of a traitor. When the
duke returned shortly afterwards to London, all the magistrates of
the city were dismissed and replaced by his creatures. On the
occasion of the fiftieth anniversary of the reign of Edward III., a
general amnesty was proclaimed; the Bishop of Winchester alone
was excluded from it.
It was the last public act of King Edward; this body so active and
robust, this spirit so bold, this will so firm, had nevertheless
undergone the effects of premature old age. The ministers were
ranging themselves beside the Duke of Lancaster; the opposition
was grouped around the young Prince Richard and the Princess of
Wales; the old king was dying alone, with Alice Perrers. It is even
said that she deserted him in his agony, after having taken the
royal ring from him. The king lay in this isolation; the servants
having dispersed in the manor of Shene, to plunder at their leisure.
A monk entered, crucifix in hand; he approached the unhappy
monarch, praying beside him, and supporting his expiring head
until the last sigh. Thus died, on the 21st of June, 1377, the great
Edward III., who had at one time appeared destined to unite upon
his head the two crowns of France and England. He died alone, in
the sixty-fifth year of his age, leaving to his grandson, a child,
instead of the whole of Aquitaine, which he had received from his
father, a few towns only upon that soil of France of which he
claimed possession. The blood of the two nations had flowed
during more than thirty years, and the struggle was as yet only at
its beginning.
Chapter XII.
Bolingbroke.
Richard II. (1377-1398).
Henry IV. (1398-1413).
The little King Richard was much fatigued on the 16th of July,
1377; it was found necessary to place him in a litter to bring him
back to the palace, after his coronation. All the former popularity of
his grandfather Edward III., all the affection which his father the
Black Prince had inspired, appeared to have accumulated upon his
head, by reason of the fear and aversion which were felt towards
John of Gaunt, duke of Lancaster. The prelates and barons
assembled on the morrow of the coronation, and selected a council
of regency of twelve members. The uncles of the king did not form
part of this body, and John of Gaunt retired to his castle of
Kenilworth; but several members of the council remained devoted
to him, and his influence soon began to be complained of.
The King of Navarre, still at war with Charles V., held a portion of
Normandy; he had surrendered Cherbourg to the English. The Duke
of Brittany, John de Montfort, being reduced to the last extremity
by the successes of Bertrand du Guesclin, had consigned Brest to
them; but these acquisitions were due to the freewill of the allies of
England, and not to its arms. John of Gaunt was defeated before
St. Malo; and, being pursued by Du Guesclin, was compelled to
return to England, while the Scots, at the instigation of France,
invaded the northern counties and took possession of Berwick
Castle. A Scottish pirate, named John Mercer, devastated the coast
as far as Scarborough. A London merchant, named John Philpot, on
the other hand, armed a small fleet, and hastening to the
encounter of Mercer, recaptured from him all the vessels which the
latter had seized; captured, besides, fifteen Spanish ships, and
returned triumphantly into the Thames, amid the plaudits of his
fellow-citizens, and to the indignation of the council, which
reprimanded the alderman for the boldness of his undertaking.
The Princess of Wales, the mother of the young king, was returning
from a pilgrimage. The crowd of insurgents surrounded her retinue.
She was popular by reason of her husband's memory and her
ransom cost her only some kisses bestowed on the more audacious
of the leaders, who had not forgotten that she had formerly been
called "the fair maid of Kent;" she passed by without further
difficulty. The malcontents thronged round an itinerant preacher
whom they had brought with them, and who displayed to them this
text, now famous:—
The conduct of the king towards his uncle the Duke of Gloucester
and his friends, the vengeance which had overtaken, after so many
years, the enemies of the favorites, revealed the character of the
sovereign in a light which caused uneasiness in the country.
Indolent and prodigal, habitually engrossed in the pleasures of
luxury and magnificence, Richard was not only capable of
momentary energy, but he maintained in the bottom of his heart
projects which he shaped to his purposes with patient
perseverance. Once delivered of the Parliament and of the Duke of
Gloucester, the Duke of Lancaster aged and in retirement in his
castle, Richard gave himself up to all his whims, certain, as he
thought, of encountering no serious opposition. "At that time," says
Froissart, "no one was great enough in England to dare to speak
against the will of the king. He had a council obedient to his
wishes, who begged him to do as he pleased; and he had in his
pay ten thousand archers, who guarded him day and night." The
extravagances of the court were insensate, and the people began
to complain, looking back regretfully upon the government of the
king's uncles, who had shown some consideration, they said, for
the nation, and consulted it in its own affairs.
The Earl of Salisbury had not a hundred men with him when the
king arrived at Conway. In this deplorable situation, the brothers of
King Richard proposed to go to Henry at Chester, in order to
ascertain his pretensions. The two dukes did not return; their
cousin Bolingbroke received them kindly, but he positively refused
to release them: all his efforts were directed towards seizing the
king in person. The Earl of Northumberland was entrusted with this
mission. By false promises he enticed the king out of Conway,
proposing an interview with Bolingbroke at Flint. Richard was
almost alone, abandoned; he followed the earl with the friends who
remained to him. They galloped along slowly, when suddenly the
king cried, "I am betrayed! Lord in Heaven, help me! Do you not
see banners and pennants flying in the valley?" Northumberland
advanced at the same time. "My lord," the unhappy monarch said
to him abruptly, "if I thought you capable of betraying me, I could
yet retreat." "No," replied the Earl, who had laid hold of his bridle;
"I have promised to conduct you to the Duke of Lancaster." The
soldiers of Northumberland began to appear; the king yielded to
necessity. "Our Saviour was sold and delivered into the hands of
His enemies," he murmured.
They arrived at Flint. Henry Bolingbroke, in all his armor, came
forward to meet his royal cousin, and bent his knee on
approaching. "Good cousin of Lancaster," said Richard courteously,
"you are welcome." "My lord," replied Henry, "I have come before
my time, but I will tell you the reason: your people complain that
you have governed them harshly for twenty-two years; if it please
God, I will help you rule them better." "Since it pleases you, it
pleases me also," meekly replied the fallen monarch; and, seated
upon a wretched courser, like a prisoner, King Richard took the road
to Chester, side by side with Henry Bolingbroke. Froissart relates
that his very dog abandoned him to lick the hand of the usurper.
His good cousin was not yet legally king; the descendants of Lionel,
the third son of Edward III., were the legitimate heirs to the
throne; no one, however, thought of them. The Duke of Lancaster
had remained in his seat; his surrounders waited in profound
silence. He rose, and, solemnly making the sign of the cross, said
in a very loud voice, "In the name of the Father, of the Son, and of
the Holy Ghost, I, Henry of Lancaster, lay claim to this kingdom of
England and to the crown, as a descendant of the good King Henry
III., and by the right which God has given me, by granting to me
the favor, through the support of my friends, to come to the
assistance of this country, which was about to perish under bad
laws and for want of government."
In the first days of his reign, the new sovereign was enabled to
believe that public opinion fully confirmed his usurpation. All the
great noblemen were eager to fulfil at his coronation their
hereditary offices; the Earl of Northumberland alone, who had
rendered eminent services to him, marched beside him in the
procession, holding aloft in sight of all the sword worn by
Bolingbroke on landing at Ravenspur. The House of Commons
responded to the slightest wishes of the king, and the greater
number of the unpopular measures of the last reign were
withdrawn by common consent. A great uproar arose in the House
of Lords: the peers who had appealed against the Duke of
Gloucester were summoned to exculpate themselves; all took their
stand upon the wish of King Richard, upon the fear which he
inspired, and upon the unanimous vote of the House.
Recriminations poured down in every part; forty gauntlets were
thrown upon the ground as challenges to combat. A weak and
timid monarch would have taken alarm in the midst of this violent
confusion: Henry IV. was enabled to calm the agitation. He divested
the "lords appellant," as they were styled, of the titles which
Richard had given to them as rewards; the Dukes of Albemarle,
Surrey and Exeter, the Marquis of Dorset and the Earl of Gloucester,
became once more the Earls of Rutland, Kent, Huntingdon, and
Somerset, and Lord Le Despencer; but the new king wreaked no
other vengeance upon them. The high treason law was restored to
more limited and less vague formulae; appeals to the Houses in
cases of treason were abolished, and the Parliament was forbidden
to delegate its authority to a commission. The eldest son of the
king was declared Prince of Wales, Duke of Guienne, Lancaster, and
Cornwall, as well as heir presumptive to the throne. Henry was too
prudent to again raise the question of the law of succession which
he had so boldly disregarded: he did not wish his hereditary right
to the throne to be discussed; he well knew that the little Earl of
March, so carefully installed in Windsor Castle, was the real heir to
the throne, as great-grand-son of Lionel, Duke of Clarence, the
elder brother of John of Gaunt. The child was not nine years of
age; the king caused him to be well brought up, as well as his
brother, and neither was destined to recover his liberty during his
lifetime; but their sister, soon afterwards married to the Earl of
Cambridge, had transmitted to the House of York those rights or
those pretensions which condemned England to half a century of
civil war.
At the very outset of his reign, however, and on the morrow of the
conspiracy of the lords appellant, Henry had attempted an
expedition into Scotland. Not daring to ask subsidies of the
Parliament, the king had had recourse to the military service of the
feudal system, and, convoking under his banners all holders of
fiefs, and furnished with the tithe voted by the clergy, he had
advanced as far as Edinburgh, to summon King Robert, the Duke of
Rothsay, his son, and all the great Scottish noblemen to come and
render homage to him. Robert III. was aged, feeble, and infirm; he
had abandoned the power to his brother, the Duke of Albany,
constantly at contention with the heir to the throne, the Duke of
Rothsay, sanguine, thoughtless, and venturesome. The young duke
hastened to Edinburgh, to defend it. Henry was repulsed; his
provisions failed him: he was compelled to withdraw from Scotland,
having reaped no other glory in this campaign than the humanity
towards the peasants, of which he had given proofs, and the
discipline which he had been enabled to maintain in his army.
The rumor that King Richard was still living had come once more to
be circulated in Scotland and in the North of England, restoring a
certain amount of courage to the malcontents. In vain had King
Henry severely punished the fomenters of this news; Richard was
expected with the Scottish army, when it entered into England in
the spring of 1402. At the head of the English opposition was a
Scotchman, George, Earl of March. The Duke of Rothsay was to
have married his daughter, but he had rejected her, to unite himself
with the family of the Earl of Douglas, the hereditary enemy of the
Earls of March. The Earl of March had thereupon renounced his
allegiance to the King of Scotland, and had allied himself with the
Percies, all powerful in the county of Northumberland. It was with
his assistance that the Scots were defeated and repulsed at Nesbit
Moor, in June, 1402. Internal rancors soon brought forward a
second army; the Earl of Douglas, furious at the success of his
rival, solicited the assistance of the Duke of Albany, and, at the
head of a considerable force, he soon overran the two banks of
Tyne. Having advanced as far as Newcastle, he was falling back,
loaded with booty, when the Earls of Northumberland and March
cut off his road on the 14th of September. The Scots covered
Homildon Hill, and the English were stationed opposite upon
another elevation. Hotspur Percy had already commanded the
charge of his men-at-arms, when the Earl of March restrained him
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookfinal.com