question

dilannanayakkara-8008 avatar image
0 Votes"
dilannanayakkara-8008 asked RahulJindal-2267 commented

Add Registry Key after install win 32 application

HI all,

Appreciate the help on below.

I have a requirement of adding a registry value after installing the CloudDrive Mapper software in Intune. I have installed the application successfully using the below script(.bat) with Win32 app. However the registry key is not in place properly either under the local machine or current user. So appreciate the help here.

start

msiexec /i "SetupCDMx64.msi" /qn LANGUAGE=EN-GB RUN=TRUE

REG ADD "HKCU\Software\IAM Cloud\CloudDriveMapper" /v "LicenceKey" /t "REG_SZ" /d "t47a6c1a2ad8e491b474a4111a7e76db10aef0e68dfe5d766c9984348" /f

Start "" "c:\program files\IAM Cloud\Cloud Drive Mapper\CloudDriveMapper.exe"

end



PS: I have tried to deploy via Posershell script using below command but it didn't successfull either.

Set-ItemProperty -Path Registry::"HKLM\Software\IAM Cloud\CloudDriveMapper" -Name "LicenceKey" -Type "String" -Value "t47ac16a2ad8e491b474a4111a7e76db10aef0e68dfe5d766c9984348" -Force


Thanks,
Dilan

mem-intune-generalmem-intune-application-management
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

dilannanayakkara-8008 avatar image
0 Votes"
dilannanayakkara-8008 answered LuDaiMSFT-0289 commented

@LuDaiMSFT-0289 Thanks for the help!

based on the research that I had so far, Intune win32 app is running as 32 applications by default, and as a result registry settings are in place under WOW6432Node. below is the solution:

I have changed the default intune win32 app behavior and configured the script to run as a 64 bit. it's all good now.

Thanks,
Dilan

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@dilannanayakkara-8008 I'm glad to hear that it's all good now. If you have any problem in the future, welcome to post in our Q&A.

Thanks and have a nice day. : )

0 Votes 0 ·
LuDaiMSFT-0289 avatar image
0 Votes"
LuDaiMSFT-0289 answered LuDaiMSFT-0289 commented

@dilannanayakkara-8008 Thanks for posting in our Q&A.

For this issue, we appreciate your help to check if you set "Run script in 64 bit PowerShell Host" to "Yes" when deploying the PowerShell script via intune.
73752-image.png
In my research, I find that if we run the script using the intune Win32 app deployment, we will run PowerShell as a 32-bit app and it will creat registry keys under the WOW6432Node registry key, not in the right place. We can refer to the following link:
https://blog.italik.co.uk/running-powershell-scripts-using-intune/
Note: Non-Microsoft link, just for the reference.

If there is anything unclear, feel free to let us know..


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



image.png (52.2 KiB)
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@LuDaiMSFT-0289 thanks for the reply. I have checked with the above settings it was successful on Local machine registry settings but I have below concerns

Is there any way that I can deploy the registry key under the current user settings?

Since I'm trying to upgrade the version of the Cloud drive application, is there any way that I can target the registry settings with the Application itself, or if not, only the devices that already installed the app? I have noticed there is no way to setup dependency on Script deployments. I also tried with PowerShell script as a Win32 app and setting up cloud drive application as a dependancy but it didn't succeed.

Thanks again,
Dilan



0 Votes 0 ·

@dilannanayakkara-8008 Thanks for your update.

For deploying the registry key under the current user, it is based on the registry itself. I don't have any way to do this.

For your test, is the cloud drive application as a dependency is also a Win32 app? I find that any Win32 app dependency needs to also be a Win32 app in our official article.
https://docs.microsoft.com/en-us/mem/intune/apps/apps-win32-add#step-5-dependencies

0 Votes 0 ·

@LuDaiMSFT-0289 thanks for the response.

Yes, I have created two Win32(.intunewin) applications. one for the registry change with PowerShell script and one for the actual cloud drive mapper application. Then I have deployed the PowerShell win32 app by setting up the cloud drive win32 app as a dependency. however, it seems the PowerShell script is not working as a win32 app because I have tried this PowerShell win32 app separately and it didn't work either.

Any idea for this. My ultimate goal is to deploy the registry value under local machine registry settings with the cloud drive mapper application.

PS: I have deployed another PowerShell win32 app with a simple command (hostname > C:\test.txt) for testing and that was succeeded without any issues.

Thanks again
Dilan

0 Votes 0 ·
Show more comments
RahulJindal-2267 avatar image
0 Votes"
RahulJindal-2267 answered RahulJindal-2267 commented

What is your end goal? Registry in HKLM or HKCU? HKCU will require to execute the script in user context.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@RahulJindal-2267 at initially, I was trying to set registry keys in place under current user reg settings(HKCU) but then I have tried under HKLM and since it has worked out for me, I was happy to go with HKLM.

However, I would like to know the possibility of configuring the registry under HKCU via intune?

Thanks for your response,
Dilan

0 Votes 0 ·

You just need to ensure that you run the script in user context.

0 Votes 0 ·