Skip to content

Commit 938c8f1

Browse files
committed
Updated PowerShell scripts
1 parent 357683b commit 938c8f1

1 file changed

Lines changed: 23 additions & 19 deletions

File tree

WindowsServerDocs/get-started/install-windows-server.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Install Windows Server from installation media
33
description: Learn how to create a bootable USB flash drive or DVD media to deploy Windows Server on physical and virtual hardware.
4-
ms.date: 01/27/2025
4+
ms.date: 10/13/2025
55
ms.topic: how-to
66
author: dknappettmsft
77
ms.author: daknappe
@@ -64,10 +64,10 @@ robocopy $source $destination /COPYALL /Z /E /SEC /R:3 /W:3
6464
6565
# Make USB drive bootable
6666
$usbDriveNumber = (Get-WmiObject -Class Win32_DiskDrive | Where-Object {$_.InterfaceType -eq "USB" -and $_.DeviceID -like "*$usbDriveLetter"}).Index
67-
bootsect /nt60 $usbDriveLetter | Out-Null
67+
bootsect /nt60 $usbDriveLetter`:
6868
6969
# Task completion notification
70-
Write-Host "Copy operation complete"
70+
Write-Host "USB Creation Complete!"
7171
Start-Sleep -Seconds 2
7272
```
7373

@@ -80,7 +80,7 @@ This script makes your USB drive bootable in FAT32 format. The FAT32 filesystem
8080
$usbDriveLetter = Read-Host "Enter USB drive letter (Ex: E)"
8181
8282
# Format USB drive
83-
Format-Volume -DriveLetter $usbDriveLetter -FileSystem FAT32 -NewFileSystemLabel "ServerUSB" -Confirm:$false
83+
Format-Volume -DriveLetter $usbDriveLetter -FileSystem FAT32 -NewFileSystemLabel "ServerUSB" -Confirm:$false -Force | Out-Null
8484
8585
# Select ISO file mount point
8686
$isoMountPointDriveLetter = Read-Host "Enter ISO mount point drive letter (Ex: F)"
@@ -92,20 +92,25 @@ robocopy $source $destination /COPYALL /Z /E /SEC /R:3 /W:3 /XF "$($isoMountPoin
9292
9393
# Split install.wim file
9494
Write-Host "[--- Splitting install.wim ---]"
95-
Start-Sleep -Seconds 2
9695
Dism /Split-Image /ImageFile:"$($isoMountPointDriveLetter):\sources\install.wim" /SWMFile:"$($usbDriveLetter):\sources\install.swm" /FileSize:3800
96+
Write-Host "" | Start-Sleep -Seconds 2
9797
98-
# Copy split install.wim files to USB drive
99-
$source = "$($isoMountPointDriveLetter):\sources\"
100-
$destination = "$($usbDriveLetter):\sources\"
101-
robocopy $source $destination /COPYALL /Z /E /SEC /R:3 /W:3 *.swm
98+
# Verify .swm files are on the USB drive
99+
Write-Host "[--- Verifying split .swm files ---]"
100+
Write-Host ""
101+
$swmFiles = Get-ChildItem "$($usbDriveLetter):\sources\*.swm"
102+
Write-Host "Number of .swm files found: $($swmFiles.Count)"
103+
$swmFiles | ForEach-Object { Write-Host $_.Name }
104+
Write-Host "" | Start-Sleep -Seconds 2
102105
103106
# Make USB drive bootable
104-
$usbDriveNumber = (Get-WmiObject -Class Win32_DiskDrive | Where-Object {$_.InterfaceType -eq "USB" -and $_.DeviceID -like "*$usbDriveLetter"}).Index
105-
bootsect /nt60 $usbDriveLetter | Out-Null
107+
Write-Host "Making USB drive bootable..."
108+
Write-Host "" | Start-Sleep -Seconds 2
109+
bootsect /nt60 $usbDriveLetter`:
110+
Write-Host ""
106111
107112
# Task completion notification
108-
Write-Host "Copy operation complete"
113+
Write-Host "USB Creation Complete!"
109114
Start-Sleep -Seconds 2
110115
```
111116

@@ -144,14 +149,14 @@ Once modifications are made to the boot order and you select to boot from either
144149
1. Under **Select keyboard settings**, select your keyboard language, then select **Next**.
145150
1. Under **Select setup option**, select **Install Windows Server**, select **I agree everything will be deleted including files, apps, and settings**, then select **Next**.
146151
1. Under **Choose a licensing method**, select the option that best serves your environment, then select **Next**:
147-
152+
148153
1. **Use a product key** - This option is for users who have an OEM, Retail, or Volume License (VL) key. If this license type is selected, proceed with the next steps.
149154

150155
1. **Pay-as-you-go** - This option is for users who desire to use their Azure subscription license. This option is only available for Windows Server 2025 and has its own set of [prerequisites](windows-server-pay-as-you-go.md?tabs=gui%2Cazureportal#prerequisites). If this license type is selected, see [Set up Windows Server Pay-as-you-go](windows-server-pay-as-you-go.md?tabs=gui%2Cazureportal#set-up-windows-server-pay-as-you-go) to continue the installation process.
151-
156+
152157
1. Under **Select image**, select your Windows Server version, then select **Next**.
153158
1. Under **Applicable notices and license terms**, review the software terms, then select **Accept**.
154-
1. Under **Select location to install Windows Server**, select the disk which you want to install Windows Server, then select **Next**.
159+
1. Under **Select location to install Windows Server**, select the disk that you want to install Windows Server, then select **Next**.
155160
1. Under **Ready to install**, select **Install**.
156161
1. Once your device reboots a few times, the **License terms** appear. Select **Accept** to proceed.
157162
1. Under **Customize settings**, provide a complex password for the Administrator account, then select **Finish**.
@@ -165,14 +170,14 @@ Once modifications are made to the boot order and you select to boot from either
165170
1. Under **Select keyboard settings**, select your keyboard language, then select **Next**.
166171
1. Under **Select setup option**, select **Install Windows Server**, select **I agree everything will be deleted including files, apps, and settings**, then select **Next**.
167172
1. Under **Choose a licensing method**, select the option that best serves your environment, then select **Next**:
168-
173+
169174
1. **Use a product key** - This option is for users who have an OEM, Retail, or Volume License (VL) key. If this license type is selected, proceed with the next steps.
170175

171176
1. **Pay-as-you-go** - This option is for users who desire to use their Azure subscription license. This option is only available for Windows Server 2025 and has its own set of [prerequisites](windows-server-pay-as-you-go.md?tabs=gui%2Cazureportal#prerequisites). If this license type is selected, see [Set up Windows Server Pay-as-you-go](windows-server-pay-as-you-go.md?tabs=gui%2Cazureportal#set-up-windows-server-pay-as-you-go) to continue the installation process.
172-
177+
173178
1. Under **Select image**, select your Windows Server version, then select **Next**.
174179
1. Under **Applicable notices and license terms**, review the software terms, then select **Accept**.
175-
1. Under **Select location to install Windows Server**, select the disk which you want to install Windows Server, then select **Next**.
180+
1. Under **Select location to install Windows Server**, select the disk that you want to install Windows Server, then select **Next**.
176181
1. Under **Ready to install**, select **Install**.
177182
1. Once your device reboots a few times, you're prompted to change the Administrator password. Hit the **Enter** button.
178183
1. Provide a complex password for the Administrator account, then hit the **Tab** button.
@@ -237,4 +242,3 @@ Once modifications are made to the boot order and you select to boot from either
237242
- [Hyper-V Technology Overview](/windows-server/virtualization/hyper-v/hyper-v-overview)
238243

239244
- [Overview of file sharing using the SMB 3 protocol in Windows Server](/windows-server/storage/file-server/file-server-smb-overview)
240-

0 commit comments

Comments
 (0)