/build/static/layout/Breadcrumb_cap_w.png

User Folder Variable

I'm trying to find out if there is a user folder variable for scripting.

Example: C:\Users\UserName

I found the below list, but I'm not seeing any reference to a user folder.


https://www.itninja.com/blog/view/kace-quick-reference-to-scripts-variables



0 Comments   [ + ] Show comments

Answers (2)

Posted by: Nico_K 2 weeks ago
Red Belt
0

Well, if you use Scripting, the default user which is used is SYSTEM. And SYSTEM does not have a user folder.
So you have to use the Windows-Variable which only works if you run the script as "logged in user" or as a determined user and then it links to their local user folders


Comments:
  • Let me give it a try as "logged in user". I never though to do that! - mcclainr@tessco.com 2 days ago
Posted by: Kiyolaka 2 weeks ago
Second Degree Green Belt
0

What is your end goal?

The environmental variable for a users directory in windows is %userprofile% or $env:userprofile in powershell, but as Nico stated this wont have the desired effect if you're running the script as "system".

You can configure scripts to run as a "logged in user" but there are some nuances to doing that. 


Depending what you're trying to do I probably have a code snippet or two I could share.


Comments:
  • The end goal is to uninstall the RingCentral application that does not get installing in the usual "program flies" folder. It's installed within the users AppData folder. I will try running it as "logged in user" as suggested by Nico_K. - mcclainr@tessco.com 2 days ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
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