Hey PowerShell Guy !, How Can I Retrieve All the Values in a Registry Key?
Today's Hey Scripting Guy ! column , How Can I Retrieve All the Values in a Registry Key? , Shows a 38 line VbScript to get the Values in a registry key.
In a PowerShell console it just takes this simple line to do the same :
get-ItemProperty 'hkcu:\Software\Microsoft\Internet Explorer\Main'
The big difference in this case is that in the VbScript version the script has to handle all the parsing itself, as with the PowerShell command shown above , the parser does all the hard work for us, you can see below as we look at some array Properties in more detail, that the Parser did "understand" them and converted them to for us on-the-fly :
PoSH> (get-ItemProperty 'hkcu:\Software\Microsoft\Internet Explorer\Main').Do404Search
1
0
0
0
PoSH > (get-ItemProperty 'hkcu:\Software\Microsoft\Internet Explorer\Main').Window_Placement | get-member
TypeName: System.Byte
Name MemberType Definition
---- ---------- ----------
CompareTo Method System.Int32 CompareTo(Object value), System.Int32 CompareTo(Byte value)
Equals Method System.Boolean Equals(Object obj), System.Boolean Equals(Byte obj)
GetHashCode Method System.Int32 GetHashCode()
GetType Method System.Type GetType()
GetTypeCode Method System.TypeCode GetTypeCode()
ToString Method System.String ToString(), System.String ToString(String format), System.String ToString(IForm...
And when you are in the right location you can replace the complete Vbscript by 3 Characters in the PowerShell console ;-)
PS HKCU:\Software\Microsoft\Internet Explorer\Main> gp .
Disable Script Debugger : no
Anchor Underline : yes
Cache_Update_Frequency : Once_Per_Session
Display Inline Images : yes
Do404Search : {1, 0, 0, 0}
Local Page : C:\Windows\system32\blank.htm
... ...
So also when you don't want no stinkin' scripts, PowerShell is the Shell for you ;-)
Enjoy,
Greetings /\/\o\/\/