Freigeben über


PowerShell Script to list WSUS Content Path

Here is a script I used to get the physical path of the WSUS content folder for the SUP servers.

$ServerNames = @("ServerSUP01","ServerSUP02")
ForEach ($Server in $ServerNames){
Invoke-Command -ComputerName $Server -Scriptblock {
$ComputerName = $env:COMPUTERNAME
[VOID][Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration")
$ServerManager = New-Object Microsoft.Web.Administration.ServerManager
$Site = $ServerManager.Sites | Where-Object {$_.Name -eq 'WSUS Administration'}
$Path = $Site.Applications | Where-Object {$_.Path -like '*'}
$vPath = $Path.VirtualDirectories | Where-Object {$_.Path -like '/Content'}
$ComputerName + " = " + $vPath.RawAttributes.physicalPath
}
}

Note: Permissions will need to be set in order to run a Scriptblock on your servers in order for this to work.