Nomad - Delete Package LsZ Files from List of DPs - PowerShell

Ok, this is more for me to reference than others.

Another great post to reference similar issues:

Came across a problem with Nomad not downloading Packages properly, it was downloading the wrong version. (which would fail)
Clients were getting LsZ File (PS100044_1.LsZ) when the Server's content was actually version 3.
DP's were not updating the LsZ files, so I deleted them, then it would re-generate with the proper version.

Script does this:
You Provide a list of DP Servers
You Provide a list of Packages you want to remove the LsZ Files for
It loops through servers and deletes any LsZ files it finds for them

$ServerList =


$PackageList =


#Custom Install Location For Nomad
$1eLSZFILESFolder = "ProgramFiles\1E\Cache\LSZFILES"

foreach ($Server in $ServerList)
    Write-Host "Starting Query on $Server"
    foreach ($Package in $PackageList)
        #Check if LsZ File (Any Version) for Package exists
        if (Test-Path "\\$Server\d$\$($1eLSZFILESFolder)\$($Package)_*.LsZ")
            #Get Name of File(s)
            $LSZFIle = (Get-ItemProperty -Path "\\$Server\d$\$($1eLSZFILESFolder)\$($Package)_*.LsZ").BaseName
            #ForEach LsZ File Version, report it exist (write-host) then DELETE IT!
            foreach ($LsZ in $LSZFIle)
                $LSZFIleName = "$($LsZ).LsZ"
                $LSZFIleFullPath = "\\$Server\d$\$($1eLSZFILESFolder)\$($LSZFIleName)"
                Write-Host "$LSZFIleName exist"
                Remove-Item $LSZFIleFullPath -Force -Verbose


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.