Solved

How to auto insert domain name into a command line?

Posted on 2009-05-13
4
262 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
  • 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

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…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

829 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