[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Run program using batch as admin.

Posted on 2006-06-05
13
Medium Priority
?
456 Views
Last Modified: 2012-06-27
Hello,

I am trying to run an application that views logs from multiple servers simultaniously. In order to gain access to all systems, I either have to login to each server through the program, or I have to right click the short cut and select "Run As" then type in mydomain\admin login id then password. I am running this program from a pc, so I dont use my admin login.  I want to create a batch file that I can run that will add my login and password automatically so I can reduce the number of steps needed to run the program everyday. I hope I explained enough.

Thanks,

Cory
0
Comment
Question by:cmoerbe
13 Comments
 
LVL 11

Expert Comment

by:DoTheDEW335
ID: 16835870
I'm sure there is a better way , but you could setup a shared folder with admin access only (even leave it empty) then just have a batch file map those folders to drive letters using the admin username/password. That would log you into those servers and should allow you to do what you want.
0
 
LVL 11

Accepted Solution

by:
DoTheDEW335 earned 600 total points
ID: 16836051
Sorry wasn't even thinking, just set the batch file to connect to the admin share.. no reason to setup a share. \\computername\c$
0
 

Author Comment

by:cmoerbe
ID: 16836404
So the .exe that I am running connects to all servers and pulls the eventlog information into it for display. So are you saying that I need to create the batch file to seperately authenticate to each server at the c$ and then the last step being to run the .exe program, and it should maintain my authentication( i.e. UNC )?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:cmoerbe
ID: 16836463
Also in the .bat how would the syntax look when adding the username and password? Would it be something like:

\\Servername\C$  domain\loginid\pw
\\Servername\C$  domain\loginid\pw
\\Servername\C$  domain\loginid\pw
run xxx.exe ?

If you can help with the script, I will double the point value :-)

Please and thank you
0
 
LVL 8

Expert Comment

by:jsvor
ID: 16836481
You should be able to create a new scheduled task on your pc that points to the batch file and set the username/password of the admin through it.  You could manully run the task or set it up for a specific time.
0
 

Author Comment

by:cmoerbe
ID: 16836616
The scheduled task was a good idea. Ideally, I could just run the schedualed task whenever I wanted the program to run, and not need a .bat file. I tried to run just the .exe with scheduled task, and it didnt work. No erroror indication of the task running. I tried manually running it as well. Is there something im missing?
0
 

Author Comment

by:cmoerbe
ID: 16836683
I see that the program is running in task manager, but its not actually opening. I am certian that username has complete access to all required systems.
0
 

Author Comment

by:cmoerbe
ID: 16836955
I think maby I should just go back to the .bat idea. Can anyone help with the syntax?
0
 
LVL 4

Assisted Solution

by:woodas26
woodas26 earned 900 total points
ID: 16837025
This line maps the network drive.  Syntax will look like this:
net use x: \\"servername"\c$ /user:domain\"username" "password"

This line disconnects the network drive.
net use x: /D

Hope this helps.
0
 

Author Comment

by:cmoerbe
ID: 16837351
I will continue to work with the syntax, but that got me off to an excellent start. Thanks all
0
 
LVL 11

Expert Comment

by:DoTheDEW335
ID: 16870265
Your welcome. Sorry I didn't elaborate on it. I was in a rush.

I use this (about the same as wood said)

net use * \\servername\c$ /user:administrator password

You should be able to use that in your batch file or if your the only one on the PC , you might as well just do

net use * \\servername\c$ /user:administrator password /persistant:yes

that will keep it mapped so you don't have to use a batch file. it will restore the connections.
0
 
LVL 11

Expert Comment

by:DoTheDEW335
ID: 16870326
Ignore that line about persistent (which I spelled wrong anyway) since it will not work. It will try to connect but it will use the credentials that you logged in as, not the ones you originally put in the net use line... I'd stick with the batch file. Sorry bout that..
0
 

Author Comment

by:cmoerbe
ID: 16874933
Thanks Dew, I was somehow able to get that batch to execute the program, but I was still having problems with the net use portion. I will give it a shot again. I also just purchased a book on scripting. I really need to get a deeper understanding of it, it seems.

Thanks for the extended reply,

C
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Can I legally transfer my OEM version of Windows to another PC?  (AKA - Can I put a new systemboard in my OEM PC?) Few of us are both IT and legal experts but we all have our own views of Microsoft's licensing rules and how they apply.  There are…
cPanel is a Unix based web hosting control panel that provides a graphical interface and automation tools designed to simplify the process of hosting a web site. cPanel utilizes a 3 tier structure that provides functionality for administrators, rese…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

872 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