Run a command on a system (Perl)
This code can be found in
Chapter 10 of Windows XP Cookbook
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the Perl code from this site.
# From the book "Windows XP Cookbook"
# ISBN: 0596007256
# ------ SCRIPT CONFIGURATION ------
use Win32::OLE;
$strComputer = '<HostName>';
$strCommand = 'cscript.exe c:\\scripts\\dircheck.vbs';
# ------ END CONFIGURATION ---------
$objController = Win32::OLE->new('WSHController');
$objRemoteScript = $objController->CreateScript($strCommand, $strComputer);
#### Error: Unexpected method of wscript.connectobject at /PerlApp/VBSPerl/WScript.pm line 322, <FH> line 15.
$objRemoteScript->Execute();
while ($objRemoteScript->Status != 2) {
select(undef, undef, undef, 100 / 1000.0);
}
#### Error: Unexpected method of wscript.disconnectobject at /PerlApp/VBSPerl/WScript.pm line 322, <FH> line 15.
|
This code has been viewed 3665 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|