in reply to How to get the User login name in Win2000

Something I used to use when I was working on a desktop management system was similar to the following:

#!/usr/bin/perl use strict; use warnings; use Win32::OLE 'in'; $Win32::OLE::Warn = 3; my $server = shift; my @users = (); getLocalUsers($server,\@users); print "Local User Accounts for $server:\n"; foreach( @users ) { print $_ . "\n"; } # USE: getLocalUsers(<computer>,\@<list>) sub getLocalUsers { my $strComputer = shift; my $users = shift; my $colAccounts = Win32::OLE->GetObject("WinNT://" . $strComputer); $colAccounts->{'Filter'} = ["user"]; map { push @{$users}, $_->{'Name'}; } in $colAccounts; }

The @users seemed to also include user accounts that current processes were running under. You could probably just filter them out.