...Because someone's gotta tell the story...


To return to the main Blog List, click Full Blog Listing.


Site Updates

Querying the registry, the easy way

Wednesday, August 28, 2013 in Powershell (Views: 3848)
Just a quick one, since it seems that examples of registry query in Powershell seem a little limited.

In this example, I am simply looking for DCM compliance (or "Compliance Settings") for SCCM 2012. So, I am looking to see if Remote Desktop is enabled (one of two CIs created for this purpose. Here is the script to make it happen.

function Get-RegistryValue($key, $value) {
(Get-ItemProperty $key $value).$value}

$a=Get-RegistryValue 'HKLM:\system\CurrentControlSet\Control\Terminal Server' fDenyTSConnections
if ($a -eq 0) {write-host Compliant}
else {write-host Not-Compliant}

Feel free to use this as one of your code samples. Happy scripting.


Related Blogs You May Be Interested In:

To leave a comment, please log in and/or register.