- Home
- Solutions
- Zluri Agents
- HOW TO INSTALL ZLURI WINDOWS AGENT USING JUMPCLOUD
HOW TO INSTALL ZLURI WINDOWS AGENT USING JUMPCLOUD
NOTE: Run the below scripts in order to get Zluri windows agent installed with config. It is recommended to run the commands in the same order.
How to remove the Zluri Windows agent lesser than expected version and add config files
Step1:
Go to DEVICE MANAGEMENT > Commands
Step2:
Under Commands Click (+) ADD > Click on Command
Step3:
Give a name to the script > Select Windows as type > check Windows Powershell
Step 4:
Add the script below in place of the command
NOTE:
Modify the <orgToken> with the Organization token [this can be found on the Zluri platform under Sources > Agents > Overview Page]
Change the expectedVersion to the latest agent version
# If Nuget is not installed, go ahead and install it [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $PkgProvider = Get-PackageProvider If ("Nuget" -notin $PkgProvider.Name){ Install-PackageProvider -Name NuGet -Force } # If PSModule RunAsUser is not installed, install it if ( -not (get-installedModule "RunAsUser" -ErrorAction SilentlyContinue)) { install-module RunAsUser -force } $Command = { #Powershell Command Goes Here. #expected version. zluri apps lesser than this version will get uninstalled. $expectedVersion="3.3.0.0" # Update the minimum version that is expected to be installed #Values to insert into client-config.json file $configValues='{"org_token": "<orgToken>","interval": "600000","local_server":"on"}' #Replace <orgToken> with valid valid orgToken ######################################################################################### # Path for zluri script logs $logPathRoot=$env:programdata If (-not (Test-Path "$logPathRoot\zluri")) { Log-Message "Creating zluri folder in $folderPath" New-Item -Path "$logPathRoot\zluri" -ItemType "directory" } # Logger function Function Log-Message([String]$Message){ Add-Content -Path "$logPathRoot\zluri\zluriscriptlog.txt" $Message } # Specify the expected version in the same format $logDate=Get-date Log-Message "$logDate" # Get the installed zluri apps $isZluriApp=Get-WmiObject -Class Win32_Product | where name -eq zluri Log-Message "$isZluriApp" # For each zluri agent present in the system foreach($zluriApp in $isZluriApp){ Log-Message "$zluriApp" $currentVersion=$zluriApp.version # Check if expected version is greater than the installed zluri version if($expectedVersion -gt $currentVersion){ Log-Message "checking if $expectedVersion greater than $currentVersion" $zluriProcess=Get-Process -Name "zluri" # stopping all zluri process Log-Message "$zluriProcess" $nid = (Get-Process zluri).id Stop-Process -Id $nid -Force Wait-Process -Id $nid -ErrorAction SilentlyContinue # Uninstalling zluri app $zluriApp.uninstall() | Out-Null # deleting zluri folders Remove-Item C:\Users\$env:username\AppData\Local\Programs\zluri -Recurse -Force -ErrorAction silentlycontinue Remove-Item C:\Users\$env:username\AppData\Roaming\zluri -Recurse -Force -ErrorAction silentlycontinue # deleting the shortcut on desktop $ShortcutsToDelete = Get-ChildItem -Path "C:\Users\$env:username\Desktop" -Filter "zluri.lnk" $ShortcutsToDelete | ForEach-Object { Remove-Item -Path $_.FullName } } } # function to create client-config.json file function zluriClientConfigFiles{ # reading param Param([String]$configFolderPath) # Setting variable for folder path & file path $folderPath = $("$configFolderPath\zluri") $filePath=$("$folderPath\client-config.json") # If there is no folderPath then create a zluri folder in that specific location If (-not (Test-Path $folderPath)) { Log-Message "Creating zluri folder in $folderPath" New-Item -Path $folderPath -ItemType "directory" } # If there is a client-config.json file in the filepath remove the file If (Test-Path $filePath) { Log-Message "deleting existing $filePath" Remove-Item $filePath } # Create client-config.json file in the filepath & insert the values New-Item -Path $filePath -ItemType "file" -value $configValues Log-Message "Created client config file in $filePath" } # Calling the function to create client-config.json file in programdata zluriClientConfigFiles -configFolderPath $env:programdata # Calling the function to create client-config.json file in localappdata zluriClientConfigFiles -configFolderPath $env:localappdata } invoke-ascurrentuser -scriptblock $Command
Step 5:
Select Launch Events as Run Manually
Step 6:
Select devices or device groups to apply this policy
(Optional) Select the Device Groups tab. Select one or more device groups where you will apply this policy. For device groups with multiple OS member types, the policy is applied only to the supported OS.
(Optional) Select the Devices tab. Select one or more devices where you will apply this policy.
Step 7:
Click Save.
Step 8:
Click on Run Now to run the command.
How to install the Zluri Windows agent
Step1:
Go to DEVICE MANAGEMENT > Commands
Step 2:
Under Commands Click (+) ADD > Click on Command
Step 3:
Give a name to the script > Select Windows as type > check Windows Powershell
Step 4:
Add the script below in place of the command
NOTE:
Replace the URL with the latest Windows agent msi link
# This script is installing Zluri for the current signed in user and usually takes around 4-5 minutes. # URL of the file to download $url = "https://zluri-prod-agent-builds.s3.us-west-2.amazonaws.com/zluri+3.3.0.msi" # Local path to save the downloaded file $localPath = "C:\Users\Public\Downloads\zluriWindowsAgent.msi" # Function to download the file function Download-File { param ( [string]$url, [string]$output ) Write-Host "Downloading file from $url..." Invoke-WebRequest -Uri $url -OutFile $output Write-Host "File downloaded to $output." } # Download the file Download-File -url $url -output $localPath # Wait for the download process to complete Start-Sleep -Seconds 1 # If Nuget is not installed, go ahead and install it [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $PkgProvider = Get-PackageProvider If ("Nuget" -notin $PkgProvider.Name){ Install-PackageProvider -Name NuGet -Force } # If PSModule RunAsUser is not installed, install it if ( -not (get-installedModule "RunAsUser" -ErrorAction SilentlyContinue)) { install-module RunAsUser -force } $Command = { #Powershell Command Goes Here. $msiPath="C:\Users\Public\Downloads\zluriWindowsAgent.msi" echo $msiPath; #install command Start-Process "msiexec.exe" -ArgumentList "/I `"$msiPath`" /qn" -Wait } echo $Command; invoke-ascurrentuser -scriptblock $Command
Step 5:
Select Launch Events as Run Manually and set Timeout After to 300 seconds
Step 6:
Select devices or device groups to apply this policy.
(Optional) Select the Device Groups tab. Select one or more device groups where you will apply this policy. For device groups with multiple OS member types, the policy is applied only to the supported OS.
(Optional) Select the Devices tab. Select one or more devices where you will apply this policy.
Step 7:
Click Save.
Step 8:
Click on Run Now to run the command.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article
NOTE: Run the below scripts in order to get Zluri windows agent installed with config. It is recommended to run the commands in the same order.
How to remove the Zluri Windows agent lesser than expected version and add config files
Step1:
Go to DEVICE MANAGEMENT > Commands
Step2:
Under Commands Click (+) ADD > Click on Command
Step3:
Give a name to the script > Select Windows as type > check Windows Powershell
Step 4:
Add the script below in place of the command
NOTE:
Modify the <orgToken> with the Organization token [this can be found on the Zluri platform under Sources > Agents > Overview Page]
Change the expectedVersion to the latest agent version
# If Nuget is not installed, go ahead and install it [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $PkgProvider = Get-PackageProvider If ("Nuget" -notin $PkgProvider.Name){ Install-PackageProvider -Name NuGet -Force } # If PSModule RunAsUser is not installed, install it if ( -not (get-installedModule "RunAsUser" -ErrorAction SilentlyContinue)) { install-module RunAsUser -force } $Command = { #Powershell Command Goes Here. #expected version. zluri apps lesser than this version will get uninstalled. $expectedVersion="3.3.0.0" # Update the minimum version that is expected to be installed #Values to insert into client-config.json file $configValues='{"org_token": "<orgToken>","interval": "600000","local_server":"on"}' #Replace <orgToken> with valid valid orgToken ######################################################################################### # Path for zluri script logs $logPathRoot=$env:programdata If (-not (Test-Path "$logPathRoot\zluri")) { Log-Message "Creating zluri folder in $folderPath" New-Item -Path "$logPathRoot\zluri" -ItemType "directory" } # Logger function Function Log-Message([String]$Message){ Add-Content -Path "$logPathRoot\zluri\zluriscriptlog.txt" $Message } # Specify the expected version in the same format $logDate=Get-date Log-Message "$logDate" # Get the installed zluri apps $isZluriApp=Get-WmiObject -Class Win32_Product | where name -eq zluri Log-Message "$isZluriApp" # For each zluri agent present in the system foreach($zluriApp in $isZluriApp){ Log-Message "$zluriApp" $currentVersion=$zluriApp.version # Check if expected version is greater than the installed zluri version if($expectedVersion -gt $currentVersion){ Log-Message "checking if $expectedVersion greater than $currentVersion" $zluriProcess=Get-Process -Name "zluri" # stopping all zluri process Log-Message "$zluriProcess" $nid = (Get-Process zluri).id Stop-Process -Id $nid -Force Wait-Process -Id $nid -ErrorAction SilentlyContinue # Uninstalling zluri app $zluriApp.uninstall() | Out-Null # deleting zluri folders Remove-Item C:\Users\$env:username\AppData\Local\Programs\zluri -Recurse -Force -ErrorAction silentlycontinue Remove-Item C:\Users\$env:username\AppData\Roaming\zluri -Recurse -Force -ErrorAction silentlycontinue # deleting the shortcut on desktop $ShortcutsToDelete = Get-ChildItem -Path "C:\Users\$env:username\Desktop" -Filter "zluri.lnk" $ShortcutsToDelete | ForEach-Object { Remove-Item -Path $_.FullName } } } # function to create client-config.json file function zluriClientConfigFiles{ # reading param Param([String]$configFolderPath) # Setting variable for folder path & file path $folderPath = $("$configFolderPath\zluri") $filePath=$("$folderPath\client-config.json") # If there is no folderPath then create a zluri folder in that specific location If (-not (Test-Path $folderPath)) { Log-Message "Creating zluri folder in $folderPath" New-Item -Path $folderPath -ItemType "directory" } # If there is a client-config.json file in the filepath remove the file If (Test-Path $filePath) { Log-Message "deleting existing $filePath" Remove-Item $filePath } # Create client-config.json file in the filepath & insert the values New-Item -Path $filePath -ItemType "file" -value $configValues Log-Message "Created client config file in $filePath" } # Calling the function to create client-config.json file in programdata zluriClientConfigFiles -configFolderPath $env:programdata # Calling the function to create client-config.json file in localappdata zluriClientConfigFiles -configFolderPath $env:localappdata } invoke-ascurrentuser -scriptblock $Command
Step 5:
Select Launch Events as Run Manually
Step 6:
Select devices or device groups to apply this policy
(Optional) Select the Device Groups tab. Select one or more device groups where you will apply this policy. For device groups with multiple OS member types, the policy is applied only to the supported OS.
(Optional) Select the Devices tab. Select one or more devices where you will apply this policy.
Step 7:
Click Save.
Step 8:
Click on Run Now to run the command.
How to install the Zluri Windows agent
Step1:
Go to DEVICE MANAGEMENT > Commands
Step 2:
Under Commands Click (+) ADD > Click on Command
Step 3:
Give a name to the script > Select Windows as type > check Windows Powershell
Step 4:
Add the script below in place of the command
NOTE:
Replace the URL with the latest Windows agent msi link
# This script is installing Zluri for the current signed in user and usually takes around 4-5 minutes. # URL of the file to download $url = "https://zluri-prod-agent-builds.s3.us-west-2.amazonaws.com/zluri+3.3.0.msi" # Local path to save the downloaded file $localPath = "C:\Users\Public\Downloads\zluriWindowsAgent.msi" # Function to download the file function Download-File { param ( [string]$url, [string]$output ) Write-Host "Downloading file from $url..." Invoke-WebRequest -Uri $url -OutFile $output Write-Host "File downloaded to $output." } # Download the file Download-File -url $url -output $localPath # Wait for the download process to complete Start-Sleep -Seconds 1 # If Nuget is not installed, go ahead and install it [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $PkgProvider = Get-PackageProvider If ("Nuget" -notin $PkgProvider.Name){ Install-PackageProvider -Name NuGet -Force } # If PSModule RunAsUser is not installed, install it if ( -not (get-installedModule "RunAsUser" -ErrorAction SilentlyContinue)) { install-module RunAsUser -force } $Command = { #Powershell Command Goes Here. $msiPath="C:\Users\Public\Downloads\zluriWindowsAgent.msi" echo $msiPath; #install command Start-Process "msiexec.exe" -ArgumentList "/I `"$msiPath`" /qn" -Wait } echo $Command; invoke-ascurrentuser -scriptblock $Command
Step 5:
Select Launch Events as Run Manually and set Timeout After to 300 seconds
Step 6:
Select devices or device groups to apply this policy.
(Optional) Select the Device Groups tab. Select one or more device groups where you will apply this policy. For device groups with multiple OS member types, the policy is applied only to the supported OS.
(Optional) Select the Devices tab. Select one or more devices where you will apply this policy.
Step 7:
Click Save.
Step 8:
Click on Run Now to run the command.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article