Solved

How to auto insert domain name into a command line?

Posted on 2009-05-13
4
264 Views
Last Modified: 2012-05-06
Does anyone know how to insert a domain name into a command line for a script? Example: \\ServerName\Users\%UserName%\

I tried using %domainname% but is doesn't work.

I am trying to use universal scripts for DFS, Example: \\%domainname%\Public Share
0
Comment
Question by:infinitybs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
Andrej Pirman earned 500 total points
ID: 24379835
Into Command prompt type

SET

and it will list all available environent variables. You might find usefull some like these:
%USERDNSDOMAIN%
%USERDOMAIN%
0
 
LVL 1

Author Comment

by:infinitybs
ID: 24380243
This is what I was looking for, but it will not allow me to use %USERDNSDOMAIN% in folder redirection GPO. I am trying to redirect the My Docs folder to \\%USERDNSDOMAIN%\UserData$\. It works when I type it into run, but not when I insert it into root path under folder redirection. Do you know a way to get this to work?
0
 
LVL 1

Expert Comment

by:Opytk
ID: 24396932
Is the domain going to change based upon the person?

So something like \\servername.domain\users\%username% does not work?
0
 
LVL 18

Expert Comment

by:Andrej Pirman
ID: 24397204
Instead of putting it in under folder redirection, you can do it also by creating/modifying a startup script, which will do something you like. Batch script is run on user's computer and will recognise all environment variables.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft has released remote PowerShell capabilities to all commercial Office 365 customers. So you can be controlled via PowerShell and not from the Office 365 admin center Download Windows PowerShell Module for Lync Online http://www.micros…
Experts-Exchange users below are the steps you can follow to upgrade your Lync server to latest CU's or cumulative updates. Note: Perform it during non-production hours.   Step 1: Backup your lync and SQL server database. Follow below article: h…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question