Hi Guys,
I'm afraid my scripting knowledge is not very strong and am trying to learn it as i go along.. but I'm stuck in the mud with something I'm trying to accomplish.
I'm using the below script I found on the net to get the SID for local user accounts, which works fine.
$objUser = New-Object System.Security.Principal.NTAccount("User1")
$strSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier])
$strSID.Value
$objUser,$strSID | out-file -filepath C:\test.txthowever I am wanting to do this with a list of local users which i have listed in a .csv file as:
user1
user2 etc.
I've then tried using something like this to get the SID for the whole list of local users, but it doesn't seem to be working for me.
$UserList=IMPORT-CSV C:\Users.csv foreach($_ in $UserList) $strSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier]) $strSID.Value $objUser,$strSID | out-file -filepath C:\test.txt
can anyone see where I'm going wrong... or advise me what format the .CSV file should be.
thanks in advance
C.
Regards Carlos Ferreira