Batch script to login to multiple windows server
Moderator: DosItHelp
Batch script to login to multiple windows server
Hi All,
Good Day . Please help me with below requirement .
1) Batch script to login to multiple windows servers from a central window server without prompting for userid and password.
2)script should also click ok on the security agreement once credentials are provided .
Thanks ,
Srinivas
Good Day . Please help me with below requirement .
1) Batch script to login to multiple windows servers from a central window server without prompting for userid and password.
2)script should also click ok on the security agreement once credentials are provided .
Thanks ,
Srinivas
Re: Batch script to login to multiple windows server
I have no experiences with networking and can't tell what is needed for 1). But 2) can't be done using Batch. It doesn't interact with graphical interfaces. And in case you're talking about the UAC prompt then I don't think that any software can confirm it (at least I hope it is not possible since it would be a security hole).
Steffen
Steffen
-
- Posts: 21
- Joined: 08 Jul 2019 05:22
Re: Batch script to login to multiple windows server
an easy way would be to save credentials using Remote Desktop Connection (mstsc.exe)...
Re: Batch script to login to multiple windows server
Thanks steffen , can this be achieved through powershell ? If so can you please help me
Srinivas
Srinivas
Re: Batch script to login to multiple windows server
Maybe someone else can. I can't.
Steffen
Steffen
-
- Posts: 128
- Joined: 23 May 2016 15:39
- Location: Spain
Re: Batch script to login to multiple windows server
with cmdkey yoy can store credentials to access computers over the net. read the command help.
long ago I used a batch script which executes cmdkey and wmic to run proccesses and fetch its output over many servers. no need to logon, nor any user session on remote server, provided not gui app was needed to be run.
Code: Select all
cmdkey
long ago I used a batch script which executes cmdkey and wmic to run proccesses and fetch its output over many servers. no need to logon, nor any user session on remote server, provided not gui app was needed to be run.
Re: Batch script to login to multiple windows server
Thanks elzooilogico, I have used WMIC in batch script . But I am encountering peculiar issue. Code goes like below .Aim is to get windows service status and if it is in running then execute next statements .
For /f %%a in (servers.txt) do (
for /f "tokens=*" %%H in (' wmic /node:%%a Service WHERE "Name = 'wuauserv' " GET State ^ | findstr "Running" ') do (
if /i %%H EQU "Running" do (
echo %%H>>D:/status.txt
)
)
)
Expected output is to get the status in the status.txt when if condition is satisfied . But the control never goes inside if , which means the condition is not satisfied . But when I comment the IF condition and try to execute the status file is being created and text inside is Running . Now if %%H contains Running then why is the if condition not getting validated .Please help .
Output for wmic is : State=Running but this when validated against if statement its failing .
For /f %%a in (servers.txt) do (
for /f "tokens=*" %%H in (' wmic /node:%%a Service WHERE "Name = 'wuauserv' " GET State ^ | findstr "Running" ') do (
if /i %%H EQU "Running" do (
echo %%H>>D:/status.txt
)
)
)
Expected output is to get the status in the status.txt when if condition is satisfied . But the control never goes inside if , which means the condition is not satisfied . But when I comment the IF condition and try to execute the status file is being created and text inside is Running . Now if %%H contains Running then why is the if condition not getting validated .Please help .
Output for wmic is : State=Running but this when validated against if statement its failing .
Re: Batch script to login to multiple windows server
I have resolved my earlier query , but now facing issue with below
for /f %%J in (mine.txt) do (
for /f %%H in ('wmic /node:%%a Service WHERE "Name = '%%J'" GET State ^| findstr "Running" ' )
how to assign variable %%J to Name as the script is not working , seems syntax error , please help .
for /f %%J in (mine.txt) do (
for /f %%H in ('wmic /node:%%a Service WHERE "Name = '%%J'" GET State ^| findstr "Running" ' )
how to assign variable %%J to Name as the script is not working , seems syntax error , please help .
Re: Batch script to login to multiple windows server
Okay, so it's impossible, if I got things right, to operate DOS on a multiple Windows server? It's too bad, I was looking at a way to coordinate my computer at home and my laptop - including the use of DOS - as I will soon spend a part of the year at one of these houses in Greece.
So, if I want to do so, I should look into a remote computer control program like TeamViewer?
So, if I want to do so, I should look into a remote computer control program like TeamViewer?
Last edited by aGerman on 27 Nov 2019 11:37, edited 1 time in total.
Reason: @Yellow_13 First and last warning - this is no platform for advertising!
Reason: @Yellow_13 First and last warning - this is no platform for advertising!