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

restart and sesume

$
0
0

Hey,

I have several scripts that have  to run back to back for setting up an domain-server 2012 R2.
I'm using Powershell 3.

The first script is:

Resize-Partition -DiskNumber 0 -PartitionNumber 2 -size (100GB)
New-Partition -DiskNumber 0 -Size 365GB -NewDriveLetter H | Format-Volume H:\
Rename-Computer -NewName ServerLUMO -Restart

The next is:

Add-VMSwitch -Name LAN -ResourcePoolName "Ethernet"

Rename-NetAdapter -Name "Ethernet" -NewName "WAN"
Rename-NetAdapter -Name "vEthernet (Broadcom NetXtreme Gigabit Ethernet - Virtual Switch)" -NewName "LAN"

New-NetIPaddress -interfacealias "WAN" -IPaddress "10.10.1.2" -prefixlength 24 -defaultgateway 10.10.1.1
Set-DnsClientServerAddress -InterfaceAlias "WAN" serveraddresses 8.8.8.8
New-NetIPaddress -interfacealias "LAN" -IPaddress "10.10.1.3" -prefixlength 24 -defaultgateway 10.10.1.1

([adsi]“WinNT://ServerLUMO/Administrator”).SetPassword(“Welkom01”)

Import-Module DnsClient
Install-WindowsFeature DNS -IncludeManagementTools
Install-WindowsFeature DHCP -IncludeManagementTools
Install-WindowsFeature RemoteAccess -IncludeManagementTools
Install-WindowsFeature WDS -IncludeManagementTools

Restart-Computer

Next:
Install-WindowsFeature RSAT-RemoteAccess-Powershell -IncludeManagementTools
Install-WindowsFeature Routing -IncludeManagementTools
Install-WindowsFeature –Name FS-Resource-Manager –IncludeManagementTools
Install-WindowsFeature FS-SyncShareService

Restart-Computer

.........>>>>>

So now my question:

What is the easiest way to restart and than resume the scripts.
Is the only way to do it setting the registry?


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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