jarthda has asked for the wisdom of the Perl Monks concerning the following question:
I made this with scriptomaitc but it doesnt quite work and i dont know perl well enough to know why.
use strict; use Win32::OLE('in'); use constant wbemFlagReturnImmediately => 0x10; use constant wbemFlagForwardOnly => 0x20; my $LOG_FILE = "D:\\dops\\st.log"; open (LOG, "+>>$LOG_FILE"); my @computers = ("OHDATASTAGESF","OHSTG2SF"); foreach my $computer (@computers) { print "\n"; print "==========================================\n"; print "Computer: $computer\n"; print "==========================================\n"; my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer") + or die "WMI connection failed.\n"; my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_Logon +Session", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); print LOG `schtasks /query /v`; foreach my $objItem (in $colItems) { print "AuthenticationPackage: $objItem->{AuthenticationPackage}\ +n"; print "Caption: $objItem->{Caption}\n"; print "Description: $objItem->{Description}\n"; print "InstallDate: $objItem->{InstallDate}\n"; print "LogonId: $objItem->{LogonId}\n"; print "LogonType: $objItem->{LogonType}\n"; print "Name: $objItem->{Name}\n"; print "StartTime: $objItem->{StartTime}\n"; print "Status: $objItem->{Status}\n"; print "\n"; } }sub WMIDateStringToDate(strDate) { return "blah ER"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Loging into a series of windows machines
by roboticus (Chancellor) on Dec 15, 2007 at 00:17 UTC | |
|
Re: Loging into a series of windows machines
by shmem (Chancellor) on Dec 15, 2007 at 00:51 UTC | |
by BrowserUk (Patriarch) on Dec 15, 2007 at 02:14 UTC | |
|
Re: Loging into a series of windows machines
by Marza (Vicar) on Dec 15, 2007 at 00:52 UTC |