This isn't the best code. But I think you know what has to be done --- code use Dumpvalue; my $dumper = Dumpvalue->new(DumpPackages => 0, veryCompact => 1);
# IPAddress use Win32::OLE qw(in); $Computername = 'Servx'; $WMI = Win32::OLE->GetObject("WinMgmts://$Computername"); $enum = $WMI->ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE Index = 0"); foreach $obj ( in $enum ){ @Feld = $obj->IPAddress; $dumper->dumpValues(@Feld); } # result like # 0 0..0 '30.0.0.203' -----Ursprüngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 14. Oktober 2005 16:05 An: Manfred Maier; Ramlakhan,Dave; [EMAIL PROTECTED] Cc: Perl-Win32-Admin@listserv.ActiveState.com Betreff: RE: Remote User Is there a way to do this with WMI instead of gethostbyaddr or any other socket-type functions? Thanks. -----Original Message----- From: Manfred Maier [mailto:[EMAIL PROTECTED] Sent: Friday, October 14, 2005 9:57 AM To: Adam Stern; 'Ramlakhan,Dave'; [EMAIL PROTECTED] Cc: Perl-Win32-Admin@listserv.ActiveState.com Subject: AW: Remote User $IP ='30.0.0.252'; ($name, $Alias, $Adresstyp, $Laenge, @Adressenfeld) = gethostbyaddr(pack('C4', split('\.', $IP)), 2); print "Name des Rechners:\t$name\n"; print "Alias zu $Name:\t $Alias\n"; print "Adresse zu $Name:\t ", join('.', unpack('C4', $Adressenfeld[0])), "\n"; print "Adresstyp zu $Name:\t $Adresstyp\n"; print "Länge zu $Name:\t $Laenge\n"; Manfred -----Ursprüngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 14. Oktober 2005 15:40 An: Ramlakhan,Dave; [EMAIL PROTECTED] Cc: Perl-Win32-Admin@listserv.ActiveState.com Betreff: RE: Remote User That is a lot shorted than the code I was using. Thanks! Is there a way to determine the name of a machine via the IP address without using nslookup? - Adam -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ramlakhan, Dave Sent: Friday, October 14, 2005 3:59 AM To: '[EMAIL PROTECTED]' Cc: 'Perl-Win32-Admin@listserv.ActiveState.com' Subject: RE: Remote User > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: 13 October 2005 21:53 > To: Perl-Win32-Admin@listserv.ActiveState.com > Subject: Re: Remote User > > > Adam Stern <[EMAIL PROTECTED]> wrote: > >Is there a way to tell who is currently logged into another > workstation on > the network via perl? > > Have perl call and parse the output of nbtstat. If you're using perl 5.6 you can try Win32::Message to get the nbtstat message names, otherwise try Win32::NetAdmin #####BEGIN use Win32::NetAdmin; my $server = "rfh-infoflex"; my %userRef; if (Win32::NetAdmin::LoggedOnUsers($server,\%userRef)) { for my $user (sort keys %userRef) { print "$user is " . $userRef{$user} . "\n"; } } #######END unfortunately you appear to get all logged on users, including batch and service accounts _______________________________________________ Perl-Win32-Admin mailing list Perl-Win32-Admin@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list Perl-Win32-Admin@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list Perl-Win32-Admin@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs