views:

220

answers:

3

Take the Winlogon registry section, I would like PowerShell to display the Data value for DefaultUserName.

This is as far as I have got:

Stage 1

get-itemproperty -path "hklm:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\"

Stage 2

I can append: -Name DefaultUserName

But this won't return a value.

Also other Names, despite being visible in Regedit, don't show in PowerShell, for example AutoAdminLogon.

Question, how can make PowerShell display what I can see with Regedit?

A: 

Does

get-itemproperty -path "hklm:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\" |% {$_.DefalutUserName} 

Work for you

rerun
Not return any valueIs |% {$_.DefaultUserName} the same as -Name DefaultUsername?
Guy Thomas
yes just checking. check to see if you have permmisons to the key.
rerun
Yes, I have full control permission.
Guy Thomas
A: 

You can try the standard command line:

reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName
Frank Bollack
Any comments on the downvote?
Frank Bollack
A: 

I tried the very same commands on another machine, they worked perfectly, as expected. Thus my original machine must have a faulty registry, or at the least, weird permissions.

Guy Thomas