Forum posts for LogonUI.exe

Perl script to gather WMI data on screensaver usage

I am very new to scripting/programming and WMI but I have been tasked with gathering information from a list of systems to see if the screensavers are active or not. I need to be able to then store the information to a file and have a cron job run every 10 minutes or so and append the results to said file.

There is noting in there as of yet to write to the file as I am stumped on just getting it to return the correct information in the first place.

Any pointers you guys can provide would be great.

Here is what I have so far:

#!/usr/bin/perl

use strict;

my $file = 'hosts.txt';
open my $info, $file or die 'Could not open $file: $!';

while( my $line = <$info>) {
my $user = 'uid';
my $password = 'pwd';
my $server = $line;
my $result = `wmic -U domain/$user%'$password' //$server 'select * from Win32_Process WHERE Name = 'LogonUI.exe''`;
my @results = split(/ /,$result);
my @tmparray = split(/|/, @results[2]);
my $isActive = 0;

use POSIX qw/strftime/;

if (@tmparray[0] eq 'LogonUI.exe') {
$isActive = 1;
}
else {
$isActive = 0;
}

print strftime('Date:%Y-%m-%d %H:%M:%S, ', localtime(time));
print 'Host:$server, Screensaver IsActive:$isActive, ';
}

View complete forum thread with replies

Other posts related to LogonUI.exe

See Related Forum Messages: Follow the Links Below to View Complete Thread

How to tell that the logon screen is currently displayed?
Perl script to gather WMI data on screensaver usage
Changing other user&#39;s registry through batch files
LogonUI.exe process doesn&#39;t terminate after switching user

What is the carbon footprint of your coffee?

Is it low? Is it high? Can this things really kill the planet Earth? Maybe the answer will surprise you. Maybe not.