![latest citrix workspace latest citrix workspace](https://omniatuki.zendesk.com/hc/article_attachments/360008320980/mceclip0.png)
Next we will start the process of another try catch to install the program.
![latest citrix workspace latest citrix workspace](https://static.macupdate.com/screenshots/292809/m/citrix-workspace-screenshot.png)
The filename has the same time/date stamp as the log file so we can compare if the script doesn’t finish up correctly. Write-Error "Site Error: Download Failure" "Site: $($LogTime): Failed to download $URL to $DownloadFullPath" > $Logname "Site: $($LogTime): Download $URL to $DownloadFullPath" > $Logname Invoke-WebRequest -Uri $URL -OutFile $DownloadFullPath We will wrap the outcome inside an https: string. That’s the second step is to build the link. links sometimes produces incomplete links, we have to build them. If it does, however, we want to take apart the links and find the one that contains the exe that we need. We check if the site has a good status of 200, if it doesn’t, then we don’t want to battle that battle.
![latest citrix workspace latest citrix workspace](https://windows-1.com/wp-content/uploads/2019/09/Citrix-Workspace-Icon.png)
In this case, we will be looking at the links and status code. While status code can give you information about if the site is up or what condition it is in. The Rawcontent is just like it sounds, raw content of the page. The $CitrixPage contains different elements inside of it. Now we have the website itself inside a variable. Write-Error "Site Error: Site not accessible" "Site: $($LogTime): Failed to access" > $Logname $CitrixPage = Invoke-WebRequest -UseBasicParsing -Uri ("") -SessionVariable websession -DisableKeepAlive We do this with the Test-Path for testing and the New-Item cmdlets. Then we test if the Citrix folder exists, if it doesn’t, once again, we create it. The first part is we are testing if the c:\temp folder exists. Remove-Item -Path $DownloadFullPath -Force "Check: $($LogTime): Install Failed" > $Logname "Check: $($LogTime): $($Citrix.Caption) - $($Citrix.Version) Installed on: $($())" > $Logname $LogTime = (Get-date).tostring("yyyy:MM:dd-hh:mm:ss")