Jump to content
Sign in to follow this  
roga

Problem to read value of a registry key

Recommended Posts

roga

I finished the installation of System Center Configuration Manager 2012 here at my company, but I'm having some problems to consolidate the number of installed clients, because I try to delete the customer problem SCCM 2007.

Command I'm using:

$SITECODE=regread("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Mobile Client\","AssignedSiteCode")

I'm sure the key exists (follows a chunk of export record):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Mobile Client]

"ProductCode"="{D6804B3A-BFEC-4AB4-BFA5-FD9BECC80630}"

"ProductVersion"="5.00.7804.1000"

"PackageCode"="{59A0EA77-D28C-4286-83A6-04BB57B9CDD6}"

"AssignedSiteCode"="001"

Whenever I get a blank value with the command mentioned, I believe that space is the "Mobile Client".

Can someone help me?

Share this post


Link to post
Share on other sites
water

What's the value of @error after RegRead?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
roga

What's the value of @error after RegRead?

brings no value is blank.

Share this post


Link to post
Share on other sites
water

Not the return value of the function but the value of the macro @error is needed.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
roga

And How do I get the @erro ?

The script runs normally.

>"C:Program Files (x86)AutoIt3SciTE..autoit3.exe" /ErrorStdOut "L:ScriptsAutoit_Codigosinventario_scriptlogon_novo.au3"

>Exit code: 0 Time: 0.311

Share this post


Link to post
Share on other sites
water

MsgBox(0, "", "@error = " & @error)
after RegRead.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
water

BTW: Do you run a 32 or 64 bit Windows version?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
water

According to the help file -1 stands for: "unable to open requested value"


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
roga

According to the help file -1 stands for: "unable to open requested value"

I'm guessing that is the space of the "Mobile Client" because I could read other values ​​without problem. Only team registration problems on the roads with space.

$SCCM2012=regread("HKEY_LOCAL_MACHINESOFTWAREClassesInstallerProductsA3B4086DCEFB4BA4FB5ADFB9CE8C6003","ProductName") ----> I can read smoothly and returns me the key value

$SITECODE=regread("HKEY_LOCAL_MACHINESOFTWAREMicrosoftSMSMobile Client","AssignedSiteCode") ---> I can not read, I believe the problem is in the "Mobile Client"

the record exists and can also access the DOS ( reg query )

Share this post


Link to post
Share on other sites
roga

Windows 8 x64

Share this post


Link to post
Share on other sites
water

Then you have to modify the key.

According to the help file (again): "When running on 64-bit Windows if you want to read a value specific to the 64-bit environment you have to suffix the HK... with 64 i.e. HKLM64."

$SITECODE = RegRead("HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\SMS\Mobile Client","AssignedSiteCode")
And I don't think you need the slash at the end of the keyname.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
roga

Then you have to modify the key.

According to the help file (again): "When running on 64-bit Windows if you want to read a value specific to the 64-bit environment you have to suffix the HK... with 64 i.e. HKLM64."

$SITECODE = RegRead("HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\SMS\Mobile Client","AssignedSiteCode")
And I don't think you need the slash at the end of the keyname.

Thank you!! worked ...

Share this post


Link to post
Share on other sites
water
:D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×