Im in the proces of learning powershell, so its all new for me. I came across this post: https://www.thelazyadministrator.com/2020/01/26/deploy-intune-applications-with-powershell-and-azure-blob-storage/ I striped down the local part of the location because i want to rely solely on the blob storage.
I tried using this for office pro plus but it does not seem to work. What it currently does: it downloads the required zip from our blob storage and puts it inside folder in %appdata%, it then starts to extract them. When nearing the extraction proces it cuts out and starts removing all the already extracted files.
I cannot seem to wrap my head around this problem.. here is my current itteration of the script:
param ( [System.String]$ZipSourceFiles = "url to zip", [system.string]$IntuneProgramDir = "$env:APPDATA\Intune", [System.String]$FullEXEDir = "$IntuneProgramDir\Intune\setup.exe", [System.String]$ZipLocation = "$IntuneProgramDir\office.zip" ) #Start download of the source files from Azure Blob to the network cache location Start-BitsTransfer -Source $ZipSourceFiles -Destination $ZipLocation #Check to see if the local cache directory is present If ((Test-Path -Path $IntuneProgramDir) -eq $False) { #Create the local cache directory New-Item -ItemType Directory $IntuneProgramDir -Force -Confirm:$False } #Copy the binaries from the network cache to the local computer cache Copy-Item $TempNetworkZip -Destination $IntuneProgramDir -Force #Extract the install binaries Expand-Archive -Path $ZipLocation -DestinationPath $IntuneProgramDir -Force #Install the program Start-Process "$FullEXEDir" -ArgumentList " /S /v/qn" Else { #Check to see if the local cache directory is present If ((Test-Path -Path $IntuneProgramDir) -eq $False) { #Create the local cache directory New-Item -ItemType Directory $IntuneProgramDir -Force -Confirm:$False } #Copy the installer binaries from the network cache location to the local computer cache Copy-Item $TempNetworkZip -Destination $IntuneProgramDir -Force #Extract the install binaries Expand-Archive -Path $ZipLocation -DestinationPath $IntuneProgramDir -Force #Install the program Start-Process "$FullEXEDir" -ArgumentList " /S /v/qn" }
paramsection seems to be adapted correctly however there are syntax errors in the script body (something went wrong incopy/paste, e.g. an orphanedelsekeyword). IMHO the script isn't optimally written at thelazyadministrator… ask at codereview.stackexchange.com for optimization of the final running version.