Link to home
Start Free TrialLog in
Avatar of fmontero
fmontero

asked on

Run command on only one of two NICs

Can I run a command or batch file on a specific NIC if a server has two NIC cards?  
ASKER CERTIFIED SOLUTION
Avatar of mt_spy
mt_spy
Flag of Kuwait image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Gerwin Jansen
@mt_spy - small typo in your cmd, should be:
netsh interface ipv4 show interface

Open in new window

@fmontero - what command are you trying to run?
Avatar of fmontero
fmontero

ASKER

I'm trying to run a comand to restart a restart remote PCs which is another question i have open with expert exchange, keeping getting Access error (5))
1. ist attempt;
shutdown /m \\<IP> /r
Access error (5)

2. 2nd attempt:
psshutdown.exe \\pcname -t 10 -f -u <administrator account> -p <password>

error:
couldn't access \\pcname
the system cannot find the file specified

3. 3rd attempt:
ran the same command for ps shutdown but with runas
-same error

I have documented other attempts that I have tried as well (will find those and post as well).  really REALLY would help me out since the remote
machines are re-cloned each week and I need to be able to run the same command on the "new'clones each week without having to keep going
to them and make changes (defeats purpose of remoting in).
also tried this:

no good, here's what i got for both commands.

C:\>psexec \\host11 -u user -p pw -c -f c:\psshutdown.exe -r -t 0
PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
Couldn't access host11:
The system cannot find the file specified.
 
then for the sutdown command:
shutdown.exe -i
 
C:\>shutdown.exe -i
host11: Access is denied.(5)
C:\>
sorry I keep commenting.  i just keep remembering small details that might help.  these machines are NOT on a domain,
 all standalone, but i have admin account to all (same since they are cloned) and can ping.

also tied this below:

C:\>psexec \\host11 -u user -p pw -c -f c:\WINDOWS\system32\shutdown.exe -r -t 0

PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
The specified application is not on the path.

C:\>

tried this too.

C:\>psexec \\host11 -u user -p pw -c -f c:\WINDOWS\system32\shutdown.exe -r -t 0


PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com

The specified application is not on the path.


C:\>
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I ever used the following syntax:

psexec \\host11 -u user -p pw "c:\WINDOWS\system32\shutdown.exe" /r /t 0


and it works fine.
Thanks ReneGe, Here's what i got in response to your response:

-From another PC, can you access: \\host11\admin$
 answer: yes I can

-From host11, can you access: \\localhost\admin$
answer: yes I can

-Assuming you are running XP or Windows7 with Telnet enabled, in a dos prompt, try: telnet host11 135. Does the dos window goes blank?

answer: yes it does


-When you ping "host11" does it at least outputs the good IP address?

answer: yes I can see the IP

-Is host11 in the same IP subnet?

answer: yes it is

-Like erobby, make sure you have no firewall enabled. If you know Windows firewall is disabled but suspect there may by another one. Try booting in safe mode with networking enabled.

-answer: firewall is NOT emnabled.

will get back to you soon on:

Go on host11 and verify it's MAC address. Make sure it is unik, compared with other PCs
-What are the enabled services on your NIC's properties (Like "Client for Microsoft network", etc...)


Cheers,
Frank
I also tried Max_197's solution:

psexec \\host11 -u user -p pw "c:\WINDOWS\system32\shutdown.exe" /r /t 0

answer:
couldn't access host11:
the system could not find the file specified
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I tried MSTSC /v:host11
it connected to pc and asked for credentials, then when i typed them in, a dialog box popped up that said:
 User generated image User generated image
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i tried eventvwr \\host11

and itsays:

Umable to connect computer host11.  error was:

Access is denied

BUT then when I close that window, it conncts to the event viewer on host11
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
these machines are not on domain, no fire wall enabled.  have to try to restart these machines without insatlling or touching remote machines

I DO know the admin credentials for remote machines (all the same).

I know it's alot (apologize for long post, but just trying to meet you half way) but here is what I have done and services on remote NICs:

1. ist attempt;
shutdown /m \\<IP> /r
Access error (5)

2. 2nd attempt:
psshutdown.exe \\pcname -t 10 -f -u <administrator account> -p <password>

error:
couldn't access \\pcname
the system cannot find the file specified


3. 3rd attempt:
ran the same command for ps shutdown but with runas
-same error



4. 4th attempt also tried this:

no good, here's what i got for both commands.

C:\>psexec \\host11 -u user -p pw -c -f c:\psshutdown.exe -r -t 0
PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
Couldn't access host11:
The system cannot find the file specified.
 
then for the sutdown command:
shutdown.exe -i
 
C:\>shutdown.exe -i
host11: Access is denied.(5)
C:\>



5. 5th attempt sorry I keep commenting.  i just keep remembering small details that might help.  these machines are NOT on a domain,
 all standalone, but i have admin account to all (same since they are cloned) and can ping.

also tied this below:

C:\>psexec \\host11 -u user -p pw -c -f c:\WINDOWS\system32\shutdown.exe -r -t 0

PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
The specified application is not on the path.

C:\>

tried this too.

C:\>psexec \\host11 -u user -p pw -c -f c:\WINDOWS\system32\shutdown.exe -r -t 0


PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com

The specified application is not on the path.


C:\>



6.6th attempt

 -From another PC, can you access: \\host11\admin$
 answer: yes I can

-From host11, can you access: \\localhost\admin$
answer: yes I can

-Assuming you are running XP or Windows7 with Telnet enabled, in a dos prompt, try: telnet host11 135. Does the dos window goes blank?

answer: yes it does


-When you ping "host11" does it at least outputs the good IP address?

answer: yes I can see the IP

-Is host11 in the same IP subnet?

answer: yes it is

-firewall is NOT emnabled.

7. 7th attempt

I tried MSTSC /v:host11
it connected to pc and asked for credentials, then when i typed them in, a dialog box popped up that said:

This computer can't connect to remote computer
Try connecting again.  If the problem continues, contact the owner of the remote computer or network administrator.


8. 8th attempt

 i tried eventvwr \\host11

and itsays:

Umable to connect computer host11.  error was:

Access is denied

BUT then when I close that window, it conncts to the event viewer on host11

9. 9th attempt

 services or remote Nic properties enabled:
-Client for MS Networks
-Qos Packet Scheduler
-File and Printer Sharing for Microsoft Networks
-Internet Protocol TCP/IP IPv4
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
do I have to run command below on remote PC to enable Remote registry?

reg add "hklm\system\currentControlSet\Control\"Terminal server" /v "AllowTSConnections" /t REG_DWORD /d 0x1 /f

and also maybe

reg add "hklm\system\currentControlSet\Control\"Terminal server" /v "fDenyTSConnections" /t REG_DWORD /d 0x1 /f

then enable Terminal services

sc config TermService start= auto

the start it

net start Termservice

If i do have to run these commands on the remote PC, what command would i use to run them?
when I ran shutdown.exe /m \\192.168.1.2 /r /t 30 /d P:1:1

i got error

Access is denied(5).
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
remote regisrty is service has a started as status.

the Netlogon service is set to manual (and has NOT been started on remote machine).
can you do a route print and post the results?
error 53 the network path was not found for  net use \\computername /user: username

I can get you the route print (not now) but the machines are on the same swith in the same physical space.  I can actualy go to the remote machine and enable stuff.  the reason i don't want to is because I have nearly 500 of them.  I believe there is a way to restart these machines without going over to them, especially when i have the admin credentials to them.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
maybe we have to talk by phone or something casue, I'm still getting Access error (5)
GO to the Control Panel and click on User Accounts.  

On the User Accounts screen click User Accounts again

On the Make Changes to User Account Screen click Change User Access Control Settings

Slide to bar all the way down to turn off
this is XP x64 , don't see those User Acct options.

Besides if i can go over to the machine and make these changes, it defeats the whole purpose of trying to restart remotely.  on 12/7 I stated the scenario (sorry probably should have restated.  the two test machines that i have in front of me are clones of the remote machines that I can't touch in the real world)

12/ 7/ scenario stated:

these machines are not on domain, no fire wall enabled.  I have to try to restart these machines without insatlling or touching remote machines

They unfortunate part is if you can't touch the machines you can't do anything.  We already established that remote commands will not work and they are not on a domain.  You need someone physically there, there is no way around this one.

Sorry I couldn't have been of more help
It's NOT User account, it's the Local Secuirty Policy on the remote machine.  we just did here (I did have access to the remote machine, BUT a WMI script can be written to do it on the remote machine possibly)

on remote machine AdminTools>Loacl secuirty Policy>Local Policies>Secuirty Options>Network access: sharing and Secuirty Model for ect. = set to Classic.

if a WMI script can be written to do the above on a remote machine, you WILL be able to run the shutdown command on the standalone remote machine.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sorry about the confusion erobby

MachineA = machine i can touch

MachineB = machine i will not be able to touch.

For testing/Building Purposes I willhave access to MachineB until we get it so that I do not have to touch it.

so I went on MachineB (even though not suppossed to touch it, but touched it to see if the Local policy was actually the issue, and it was, see cahnge made on MachineB below.  no I have to fugure out if a WMI script can achieve the same remotely)

on remote MachineB -> AdminTools>Loacl secuirty Policy>Local Policies>Secuirty Options>Network access: sharing and Secuirty Model for ect. = set to Classic.

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
after i made that change, I ran below command on MachineA:

net use q: \\host1 \c$ /user:user
shutdown -r /m \\<IP>

and it shutdown MachineB down.
So you ran your test and it worked you just have no way of verifying that it worked?

Ok Lets assume it did work what would be different about your environment?
It did work in our test environment, I saw it work and had access to both machines.  we verified here in person that it worked.  nothing would be different in remote environment.

 I just have to now be able to change below setting WITHOUT touching remote MachineB:

on remote MachineB -> AdminTools>Loacl secuirty Policy>Local Policies>Secuirty Options>Network access: sharing and Secuirty Model for ect. = set to Classic
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sorry, maybe I wasn't clear.  I have the two machines in front of me.  I saw machineB shutdown.  but I had to touch machineB and change

on remote MachineB -> AdminTools>Loacl secuirty Policy>Local Policies>Secuirty Options>Network access: sharing and Secuirty Model for ect. = set to Classic

after i did, i was able to shutdown machineB FROM machineA.  I was machineB, go down and restart.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
although I was the one who eventully found the issue, it was only through, I was very impressed with the dilligent responses and attention to detail by the techs involved.
Thanks for the points
No problem, you guys were very helpful.