Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Powershell - change IP on remote computer and shutdown the box

$
0
0

Hi Friends,

I'm using the technet for the very first time...

I have a task to complete where I should update the IP address on remote server and shutdown a wintel box.

My initial thoughts was to use Psexec... however I assume the remote connectivity will get lost once the ip gets changed and therefore shutting down the box will be problem...

this lead me to write a bat script where I can save a copy on the remote server using powershell and execute it from there. it works on my laptop locally but when I tried to work it out remotely - I find nothing happening.

could you advise how I can achieve it. code below...

$a = "192.168.1.112"
$b = "255.255.255.0"
$c = "192.168.1.1"
Start-Process -Verb RunAs "C:\temp.bat" -ArgumentList $a, $b, $c

temp.bat :--

@echo off
netsh interface ip set address "Ethernet" static %1 %2 %3 1
timeout /t 2
shutdown /s /f /d p:1:2 /c "Performing Migration activity" /t 10




Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>