On my Windows 10 machine I am using Win32::LookupAccountSID() to get the SID by account. In cmd.exe I run:
whoami /user
I grab the SID from the output and use it on the below $sid variable but the account printed is empty any idea what is wrong with the script?
use strict;
use warnings;
use Win32;
my $account;
my $domain;
my $sidtype;
my $sid = 'S-1-5-21-1994326832-1066739575-5522801-113721';
Win32::LookupAccountSID(undef,$sid,$account,$domain,$sidtype);
print $account;