DSM not returning regestry value
-
quinta-feira, 29 de março de 2012 07:15
Hi !
I set up a DCM rule according to what I coud make out from Microsoft technet articles.
I have a "General Item" added to check the regvalue for proxy settings on computers.But the problem is I do not get the value of the setting in return, the report only tells me that the computers are complient.
How can I make it return the actual registry value ?
// Lundegard
Todas as Respostas
-
quinta-feira, 29 de março de 2012 07:42DCM is not designed to return the registry value from a system. If you want to capture registry values, see http://myitforum.com/cs2/blogs/skissinger/archive/2009/04/13/mark-cochrane-s-regkeytomof.aspx
Anoop C Nair - @anoopmannur
MY BLOG: http://anoopmannur.wordpress.com
User Group: ConfigMgr Professionals
This posting is provided AS-IS with no warranties/guarantees and confers no rights.
-
quinta-feira, 29 de março de 2012 11:50
Unfortunately proxy setting are a HKCU and Marc tool will not collection those.
Unless there is a real need to collect this data, I would follow up with those PCs are re not compliant and fix them. If you need to then you will need to create a two-step process to gather the data.
- Create a sms_def.mof and Configraution.mof edit to collect this data.
- Create a vbs to add a registry key and set permissions so that users can add / delete data
- Create a vbs to inventory this data and add it to the reg key above
- Have an advert re-run your inventory vbs every week.
http://www.enhansoft.com/
-
sexta-feira, 30 de março de 2012 09:31
Funnily, I had someone in our company request this also. As Garth mentions, Proxy settings are HKEY_CURRENT_USER values, so wouldn't be available using the methods Anoop mentioned. However, I created a slightly different method to obtain HKCU settings via SCCM.
- Create a script that runs via Logon (e.g. Group Policy Login script), that reads the HKCU values, and then sets an environment variable based on those values.
- Make sure the MICROSOFT|ENVIRONMENT|1.0 class is enabled in SMS_DEF.MOF
- Wait a few days for the values to build up.
The reason this works is that when Hardware Inventory runs, it reads all environment variables for any loaded user, which includes the logged on user(s), plus the builtin ones (e.g. SYSTEM).
Anyway, here's the script:-
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Created by: Tom Watson 'Created on: 9 Feb 2012 'Purpose: Set environment variable based on HKEY_CURRENT_USER values '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ On Error Resume Next const HKEY_CURRENT_USER = &H80000001 const HKEY_LOCAL_MACHINE = &H80000002 '// Create an instance of the WshShell object set WshShell = CreateObject("WScript.Shell") '// Set the registry object Set oReg=GetObject("winmgmts:\\.\root\default:StdRegProv") '// Specify the environment type ( System, User, Volatile, or Process ) set oEnv=WshShell.Environment("User") '// Get the string value (from registry) strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings" strValueName = "ProxyServer" oReg.GetStringValue HKEY_CURRENT_USER,strKeyPath,strValueName,strValue '// Create environment variable oEnv("MyProxyServer") = strValue '// Get the DWORD value (from registry) strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings" strValueName = "ProxyEnable" oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue '// Create environment variable oEnv("MyProxyEnable") = dwValueThis scripts reads HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings|ProxyServer, and HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings|ProxyEnable, and sets user environment variables "MyProxyServer" and "MyProxyEnable" accordingly.
I might blog about this method. There are some drawbacks, but it might be a good starting point.
Regards,
Tom Watson,
E-Mail: Tom_...@...
Blog: http://myitforum.com/cs2/blogs/tom_watson -
sexta-feira, 30 de março de 2012 10:12
Hi Tom !
Thanks for reply, but we discarded the idea of using any kind of logon script or any changes to MOF files, due to fact that we need a change record for that kind of work.
Any settings in Desired Config Mgmt we cad do on a regular request.I will simply have to make a script in the DCM to return complianr ot noncompliant, instead of the actual regvalues.
// Lundegard
-
segunda-feira, 2 de abril de 2012 19:34
I need to try to use DCM without any .mof changes. Due to byrochracy.
I've created this script, and added to the DCM Item as Setting
It rerutns a value of 1-4 if one of the non complient AutoProxy settings are enabled
Still, I only get compliant results, even from the computers that have one of these proxy.pac enabled.What am I missing, there is something in the documentation Iäve read that I missunderstand.
I expected that a VBscript returning a value, to return a non compliant computer setting.
------------------
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
strProxyPac1="http://cbdks007.global.internal.com/proxy.pac"
strProxyPac2="http://cbdks006.global.internal.com/proxy.pac"
strProxyPac3="http://cbdks007.global.internal.com/test_proxy.pac"
strProxyPac4="http://cbdks006.global.internal.com/test_proxy.pac"ExitCode = CheckProxyConfigCompliance
WScript.Quit(ExitCode)Function CheckProxyConfigCompliance()
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"
strValueName = "AutoConfigURL"
oReg.GetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValueIf InStr (1, LCase(strValue), LCase(strProxyPac1), 1) = 1 Then
CheckProxyConfigCompliance = 1
End If
If InStr (1, LCase(strValue), LCase(strProxyPac2), 1) = 1 Then
CheckProxyConfigCompliance = 2
End IfIf InStr (1, LCase(strValue), LCase(strProxyPac3), 1) = 1 Then
CheckProxyConfigCompliance = 3
End If
If InStr (1, LCase(strValue), LCase(strProxyPac4), 1) = 1 Then
CheckProxyConfigCompliance = 4
End IfEnd Function
------------------------------// Lundegard
-
segunda-feira, 2 de abril de 2012 22:30
This is going to get the data for the current user, which will always be local system. So unless you are looking for which computers are running those proxy setting. This is not going to get you what you wanted.
http://www.enhansoft.com/
-
terça-feira, 3 de abril de 2012 05:06
Hi Garth !
Now I do not understand your first sentence.
But, yes, I do look for computers with thoose settings.Theese settings are old User GPO's. And customer has requested to know which computers still use them.
So, what I am looking for, is a way to use DCM to return computers as non-compliant, if these proxy settings are active under HKEY_CURRENT_USER.
// Lundegard
-
segunda-feira, 23 de abril de 2012 23:14Moderador
Your DCM script setting is running in system context, and as such the 'current user' is system, not any one user. This will not be able to access HKCU to get the information you want. If you create a registry setting instead of script, and it is for HKCU registry hive, it will load all known user hives one by one and check compliance of each, which may or may not be what you want it to do. The behavior in 2012 is different, it will only run for a logged on user and check for that user only.
DCM by design will report Compliant if it finds what you are looking for, so if you are using the "Equals" operator, this would be the same as reporting back the actual value in your rule. If the value is not the expected value in your rule, then it will report non-compliance with actual value and expected value both returned in the non-compliance details.
This posting is provided "AS IS", provides no warranties, and confers no rights. -- Kevin
- Sugerido como Resposta Kevin Myrup [MSFT]Microsoft Employee, Moderator quarta-feira, 2 de maio de 2012 04:21

