/build/static/layout/Breadcrumb_cap_w.png

How to add variable network share path for logonuser in registry?

Hi all,

I want to change the registry entry for OneNote from C:\Users\<user>\Documents\OneNote Notebooks to a network share. 

I set this up as following and pushed it out to a test machine via KACE SMA

Set HKCU\Software\Microsoft\Office\16.0\OneNote\Options\Save!Last Local Notebook Path to \\okanagan\homedirs\%USERNAME%\

The key pushes out and gets added to the registry just fine. However, when I try to save a OneNote file to that new path, it says it does not exist and asks if I want to create it. If I say yes, it does create that OneNote file in the new folder %Username%.


I also tried changing the variable to %LogonUser% without success.

I've been scavenging the internet for a solution on this but so far no luck.

I also came across this post which is a similar issue to mine but unfortunately not quite:

https://www.itninja.com/question/using-username-in-a-registry-key-wps


How do I get it to recognize that it should be picking up the current logged on user?  Any help would be appreciated!







0 Comments   [ + ] Show comments

Answers (1)

Posted by: chucksteel 4 years ago
Red Belt
0

You may need to change the value type to REG_EXPAND_SZ. See https://docs.microsoft.com/en-us/windows/win32/sysinfo/registry-value-types 

I don't use OneNote so I can't verify if the default key is REG_SZ or REG_EXPAND_SZ.



Comments:
  • Thanks Chucksteel. KACE does not seem to have that option 'Reg_expand_SZ'. Do you happen to know how I would deploy that script with the SMA? - tatami 4 years ago
    • Use the reg.exe command. - chucksteel 4 years ago
      • Unfortunately that doesn't work for REG_Expand_SZ Keys. It works for any other type though. I used this many times in the past.
        Even when running this locally, the batch completes but does not add the Key to the registry. - tatami 4 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ