Skip to content

PS

Write a air gapped wsus powershell script with multiple selections such copying the data from the internet connected wsus server onto a usb drive and i will physically move the usb drive to the offline wsus server and run the other powershell selection to copy it onto the server. Then finally need to do a wsus clean up process

Here is a PowerShell script that will help you copy the data from an internet-connected WSUS server onto a USB drive, transfer it to an air-gapped WSUS server, and perform a WSUS cleanup process:

bashCopy code# WSUS PowerShell Script for Air-Gapped Environments

# Define the source and destination paths for the WSUS update files
$SourcePath = "C:\WSUS-Updates"
$DestinationPath = "E:\WSUS-Updates"

# Define the location where you want to store the WSUS cleanup log
$CleanupLogPath = "C:\WSUS-Cleanup.log"

# Copy the WSUS update files from the internet-connected server to the USB drive
Copy-Item -Path $SourcePath -Destination "F:\" -Recurse

# Move the USB drive to the air-gapped WSUS server and copy the update files to the destination folder
Copy-Item -Path "F:\WSUS-Updates" -Destination $DestinationPath -Recurse

# Perform a WSUS cleanup process
Write-Output "Starting WSUS cleanup process..."
$CleanupStart = Get-Date
Invoke-WsusServerCleanup -CleanupObsoleteComputers -CleanupObsoleteUpdates -CleanupUnneededContentFiles -CompressUpdates -DeclineExpiredUpdates -DeclineSupersededUpdates -Verbose | Out-File -FilePath $CleanupLogPath
$CleanupEnd = Get-Date
Write-Output "WSUS cleanup process completed in $($(New-TimeSpan -Start $CleanupStart -End $CleanupEnd).ToString())."

# Remove the WSUS update files from the USB drive
Remove-Item -Path "F:\WSUS-Updates" -Recurse

To use this script, you will need to customize the paths and options to fit your specific environment. The script assumes that you have already downloaded the WSUS update files to the source folder on the internet-connected server.

When you run the script, it will copy the update files from the source folder to the USB drive, which you can then physically move to the air-gapped WSUS server. Once the USB drive is connected to the air-gapped server, run the script again to copy the update files to the destination folder on the server and perform a WSUS cleanup process.

After the cleanup process is complete, the script will remove the update files from the USB drive to prevent any potential security risks.

Proudly powered by WordPress

Write a air gapped wsus powershell script with multiple user selections such copying the data from the internet connected wsus server onto a usb drive and using the wsusutil commandfor exporting .xml.gz file extension file and .log file extension, i will physically move the usb drive to the offline wsus server and run the other powershell selection to copy it onto the server.

Here is a PowerShell script that will help you copy the data from an internet-connected WSUS server onto a USB drive, export WSUS data as XML and LOG files using wsusutil, transfer it to an air-gapped WSUS server, and copy it onto the server:

bashCopy code# WSUS PowerShell Script for Air-Gapped Environments

# Define the source and destination paths for the WSUS update files
$SourcePath = "C:\WSUS-Updates"
$DestinationPath = "E:\WSUS-Updates"

# Define the path for the WSUS export files
$ExportPath = "C:\WSUS-Export"

# Prompt user to select which files to export
$ExportXML = Read-Host "Export XML file? (y/n)"
$ExportLOG = Read-Host "Export LOG file? (y/n)"

# Create the WSUS export directory if it doesn't exist
if (!(Test-Path $ExportPath)) {
    New-Item -ItemType Directory -Path $ExportPath
}

# Copy the WSUS update files from the internet-connected server to the USB drive
Copy-Item -Path $SourcePath -Destination "F:\" -Recurse

# Export WSUS data as XML and/or LOG files using wsusutil
if ($ExportXML -eq "y") {
    Write-Output "Exporting WSUS data as XML file..."
    Start-Process -FilePath "C:\Program Files\Update Services\Tools\wsusutil.exe" -ArgumentList "export", "C:\WSUS-Export\WSUS-Export.xml.gz" -Wait
}

if ($ExportLOG -eq "y") {
    Write-Output "Exporting WSUS data as LOG file..."
    Start-Process -FilePath "C:\Program Files\Update Services\Tools\wsusutil.exe" -ArgumentList "export", "C:\WSUS-Export\WSUS-Export.log" -Log -Wait
}

# Move the USB drive to the air-gapped WSUS server and copy the update files and export files to the destination folder
Copy-Item -Path "F:\WSUS-Updates" -Destination $DestinationPath -Recurse
Copy-Item -Path $ExportPath -Destination "E:\" -Recurse

# Remove the WSUS update and export files from the USB drive
Remove-Item -Path "F:\WSUS-Updates" -Recurse
Remove-Item -Path $ExportPath -Recurse

To use this script, you will need to customize the paths and options to fit your specific environment. The script assumes that you have already downloaded the WSUS update files to the source folder on the internet-connected server.

When you run the script, it will prompt you to select which files to export (XML and/or LOG). It will then copy the update files from the source folder to the USB drive and export WSUS data as XML and/or LOG files using wsusutil. Once the USB drive is connected to the air-gapped WSUS server, run the script again to copy the update and export files to the destination folders on the server.

After the files are copied, the script will remove the update and export files from the USB drive to prevent any potential security risks.

Proudly powered by WordPress

Write a air gapped wsus powershell script that copies the wsus data folder from the internet connected wsus server onto a usb drive and using the wsusutil command export .xml.gz file extension file and .log file extension and copy onto usb drive, i will physically move the usb drive to the offline wsus server and run the other powershell selection to run the wsusutil import command xml.gz file extension file and .log file extension copy it onto the offline server.

Here’s a PowerShell script that will help you copy the WSUS data folder from an internet-connected server to a USB drive, export WSUS data as XML and LOG files using wsusutil, and transfer it to an air-gapped WSUS server:

bashCopy code# WSUS PowerShell Script for Air-Gapped Environments

# Define the source and destination paths for the WSUS data folder and export files
$SourcePath = "C:\WSUS"
$DestinationPath = "E:\WSUS"
$ExportPath = "C:\WSUS-Export"

# Prompt user to select which files to export
$ExportXML = Read-Host "Export XML file? (y/n)"
$ExportLOG = Read-Host "Export LOG file? (y/n)"

# Create the WSUS export directory if it doesn't exist
if (!(Test-Path $ExportPath)) {
    New-Item -ItemType Directory -Path $ExportPath
}

# Copy the WSUS data folder from the internet-connected server to the USB drive
Copy-Item -Path $SourcePath -Destination "F:\" -Recurse

# Export WSUS data as XML and/or LOG files using wsusutil and copy it onto the USB drive
if ($ExportXML -eq "y") {
    Write-Output "Exporting WSUS data as XML file..."
    Start-Process -FilePath "C:\Program Files\Update Services\Tools\wsusutil.exe" -ArgumentList "export", "C:\WSUS-Export\WSUS-Export.xml.gz" -Wait
    Copy-Item -Path "C:\WSUS-Export\WSUS-Export.xml.gz" -Destination "F:\" -Force
}

if ($ExportLOG -eq "y") {
    Write-Output "Exporting WSUS data as LOG file..."
    Start-Process -FilePath "C:\Program Files\Update Services\Tools\wsusutil.exe" -ArgumentList "export", "C:\WSUS-Export\WSUS-Export.log" -Log -Wait
    Copy-Item -Path "C:\WSUS-Export\WSUS-Export.log" -Destination "F:\" -Force
}

# Move the USB drive to the air-gapped WSUS server and copy the WSUS data folder and export files to the destination folder
Copy-Item -Path "F:\WSUS" -Destination $DestinationPath -Recurse
Copy-Item -Path "F:\WSUS-Export" -Destination "E:\" -Recurse

# Remove the WSUS data folder and export files from the USB drive
Remove-Item -Path "F:\WSUS" -Recurse
Remove-Item -Path "F:\WSUS-Export" -Recurse

To use this script, you will need to customize the paths and options to fit your specific environment. The script assumes that you have already installed and configured WSUS on the internet-connected server and that the WSUS data folder is located at C:\WSUS.

When you run the script, it will prompt you to select which files to export (XML and/or LOG). It will then copy the WSUS data folder from the source path to the USB drive and export WSUS data as XML and/or LOG files using wsusutil, and copy them onto the USB drive as well. Once the USB drive is connected to the air-gapped WSUS server, run the script again to copy the WSUS data folder and export files to the destination folders on the server.

After the files are copied, you will need to import the WSUS data onto the air-gapped server using the wsusutil import command with the XML and LOG files that were exported and copied

Proudly powered by WordPress

Write a air gapped wsus powershell script that copies the wsus data folder from the internet connected wsus server onto a usb drive and using the wsusutil command export .xml.gz file extension file and .log file extension without user prompt and copy onto usb drive, i will physically move the usb drive to the offline wsus server and run the other powershell selection to run the wsusutil import command xml.gz file extension file and .log file extension without user prompt copy it onto the offline server.

Here’s a PowerShell script that automates the process of copying the WSUS data folder from an internet-connected server to a USB drive, exporting WSUS data as XML and LOG files using wsusutil, and transferring it to an air-gapped WSUS server without user prompts:

bashCopy code# WSUS PowerShell Script for Air-Gapped Environments

# Define the source and destination paths for the WSUS data folder and export files
$SourcePath = "C:\WSUS"
$DestinationPath = "E:\WSUS"
$ExportPath = "C:\WSUS-Export"

# Create the WSUS export directory if it doesn't exist
if (!(Test-Path $ExportPath)) {
    New-Item -ItemType Directory -Path $ExportPath
}

# Copy the WSUS data folder from the internet-connected server to the USB drive
Copy-Item -Path $SourcePath -Destination "F:\" -Recurse -Force

# Export WSUS data as XML and LOG files using wsusutil and copy it onto the USB drive
Write-Output "Exporting WSUS data as XML and LOG files..."
Start-Process -FilePath "C:\Program Files\Update Services\Tools\wsusutil.exe" -ArgumentList "export", "C:\WSUS-Export\WSUS-Export.xml.gz" -Wait -NoNewWindow
Copy-Item -Path "C:\WSUS-Export\WSUS-Export.xml.gz" -Destination "F:\" -Force
Start-Process -FilePath "C:\Program Files\Update Services\Tools\wsusutil.exe" -ArgumentList "export", "C:\WSUS-Export\WSUS-Export.log" -Log -Wait -NoNewWindow
Copy-Item -Path "C:\WSUS-Export\WSUS-Export.log" -Destination "F:\" -Force

# Move the USB drive to the air-gapped WSUS server and copy the WSUS data folder and export files to the destination folder
Copy-Item -Path "F:\WSUS" -Destination $DestinationPath -Recurse -Force
Copy-Item -Path "F:\WSUS-Export" -Destination "E:\" -Recurse -Force

# Remove the WSUS data folder and export files from the USB drive
Remove-Item -Path "F:\WSUS" -Recurse -Force
Remove-Item -Path "F:\WSUS-Export" -Recurse -Force

To use this script, you will need to customize the paths and options to fit your specific environment. The script assumes that you have already installed and configured WSUS on the internet-connected server and that the WSUS data folder is located at C:\WSUS.

When you run the script, it will automatically copy the WSUS data folder from the source path to the USB drive and export WSUS data as XML and LOG files using wsusutil, and copy them onto the USB drive as well. Once the USB drive is connected to the air-gapped WSUS server, run the script again to copy the WSUS data folder and export files to the destination folders on the server.

After the files are copied, you will need to import the WSUS data onto the air-gapped server using the wsusutil import command with the XML and LOG files that were exported and copied, without any user prompts.