$LogFilePath = "$HOMEbackuplogSystemInventory.log"
# Finding all usernames(fullnames) on a computer system
$ALL_Usernames = ([ADSI]"WinNT://$env:COMPUTERNAME").Children | where {$_.SchemaClassName -eq 'user'} | select @{l='name';e={$_.name}}
# Saving the gathered information of the computer system as a log file, named "SystemInventory.log" and the user can
# see his/her computer's basic information, which is up to date on "notepad.exe"
Write-Output "Names of All Registered System Users on the System: $ALL_Usernames" >> $LogFilePath
Hi. I have a question.
This script is supposed to find out the value($ALL_Usernames) and then to be saved $LogFilePath. But, actually, there is
no usernames in the output file.log. I want all usernames on the computer in the file, SystemInventory.log.
Where did I go wrong? Would you please help me out?
Many thanks in advance~!