A
A
Alexander2020-12-03 11:58:37
Command line
Alexander, 2020-12-03 11:58:37

How to execute a command without using psexec?

Guys, sometimes you need to "restart" the network interface on a remote PC, I do this (off / on):

psexec \\192.168.1.111 "cmd" "/c netsh interface set interface name="Подключение по локальной сети" admin=DISABLED & netsh interface set interface name="Подключение по локальной сети" admin=ENABLED"


How to execute without psexec ?

It seems that according to help'u the netsh command supports working with a remote computer.

Where to put -r 192.168.1.111 into this netsh interface set interface name="Local Area Connection" admin=DISABLED & netsh interface set interface name="Local Area Connection" admin=ENABLED" to make it work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Bezrukov, 2020-12-03
@NortheR73

PowerShell?
$nw = Get-WmiObject Win32_NetworkAdapter -ComputerName "FQDN or IP" -Filter "Name LIKE '*Wireless*'" -Credential (Get-Credential)
$nw.Disable()
$nw.Enable()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question