Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Force SMS Hardware Inventory

by OzzyOsbourne (Chaplain)
on May 14, 2002 at 19:16 UTC ( #166542=sourcecode: print w/replies, xml ) Need Help??
Category: NT Admin
Author/Contact Info OzzyOsbourne
Description: Command line force of an SMS hardware inventory on a remote box.
# 5.14.02 Jonathan E. Dyer
# Script forces a hardware inventory for SMS for a single box running 
# Run script like this: <server name>
# no backslashes are needed in the server name.

# ping the box, and if ping response
#   Start SMS hardware inventory service (hwservvice)
#   Query the SMS hardware inventory service until it's stopped (it st
+ops itself)
#   Stop the SMS client inventory service (cliservice)
#   Query the SMS client inventory service is until stopped
#   Start the SMS client inventory service service
#   Query the SMS client inventory service until it's started
# else if no ping response
#   end

use strict;
use Win32::Service qw(GetStatus StopService StartService);

#define variables
my $server;
my $hwservice='sms hardware inventory agent service';
my $cliservice='clisvc';
use Net::Ping;
my $server=$ARGV[0];
#get the input

#Stop/start the services
my $p = Net::Ping->new("icmp");
if ($p->ping("$server",15)){;
    print "No ping response from $server";
print "\n";

sub getstatus{
    my  %statusHash;
    my %statcodeHash = ('1' => 'stopped','2' => 'start pending','3' =>
+ 'stop pending','4' => 'running','5' => 'continue pending','6' => 'pa
+use pending','7' => 'paused');
    do {
    GetStatus("$_[0]", "$_[1]", \%statusHash);
    }until ($statusHash{CurrentState}==$_[2]);
    print " $_[1] $statcodeHash{$statusHash{\"CurrentState\"}} on $_[0
Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://166542]
[Veltro]: usemodperl This question was asked in 2011 https://stackoverf 8017508/solutions- to-convert-http- traffic-to-https- proxy-relay

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2018-06-24 17:20 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.