We help IT Professionals succeed at work.

How to run a logo script?

SpaceCoastLife
on
64 Views
Last Modified: 2020-05-23
Attempting to run a logon script in windows 10 which is new territory for me insofar as acceptable characters. For example, the first one runs fine, the 2nd one does not. Why?

Net Use M: \\192.168.1.22\video /user:admin AS3145florida   Maps



Net Use M: \\192.168.1.22\video /user:admin ^7dUff2*!           Errors
Comment
Watch Question

bbaoIT Consultant
CERTIFIED EXPERT

Commented:
because the 2nd one having invalid symbols that are not acceptable at Windows command line due to history reason.

i know the actual password might be correct, but the ^, *,  and ! symbols can't be accepted here.

you have to change the password if you do need to use command line to map the drive here. :-)

Author

Commented:
are those 3 the only ones I need to change?
bbaoIT Consultant
CERTIFIED EXPERT

Commented:
yes, letters and numbers are all acceptable.

Author

Commented:
Really? There are no allowable special characters in windows?
IT Consultant
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
ahhh. Makes sense. Thanks for the help.
bbaoIT Consultant
CERTIFIED EXPERT

Commented:
thanks for accepting my answer.

sorry for the typos as i was typing the message using my phone, but i guess you did get what i meant. :-)
CERTIFIED EXPERT
Most Valuable Expert 2019
Most Valuable Expert 2018

Commented:
Sorry, but that answer is incorrect.
These characters may be invalid for a filename, but not for a password.
The issue here is that the caret ^ is the escape character in Batch, so the string that's actually passed to net.exe as password is "7dUff2*!".
All you have to do is enclose the argument in double quotes:
net.exe use M: \\192.168.1.22\video /user:admin "^7dUff2*!"

Open in new window

bbaoIT Consultant
CERTIFIED EXPERT

Commented:
thanks for correcting me oBdA.

i just tested, yes, using double quotes: is the way to enter a password with symbols.

hence the old DOS limitation doesn't apply here for passwords in a Command Prompt window in Windows, though the other DOS limitation may still apply e.g. special device names such as CON or PRN can't be used as a file name.
Steve KnightIT Consultancy
CERTIFIED EXPERT

Commented:
And to add another comment here.... seriously, passwords in plain text in a batch file login script that by definition anyone can read and even see scroll over their screen?!!!!  I presume maybe pointing at a simple NAS share that isn't integrated with your AD?

If you really can't use AD accounts, I would suggest getting credentials added as one-off to the user's profiles e.g.

cmdkey /add:\\server\share /user:username /pass:password

then can map the drive using the saved credentials with

net use n: \\server\share

or if you really have to storing the password partially hidden as part of the batch file using ADS -- this is still readable if you know how:  http://scripts.dragon-it.co.uk/links/batch-password1

Steve

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.