Files
homelab-scripts/CCPCryptFS Install.ps1
2024-03-01 16:12:25 +00:00

26 lines
905 B
PowerShell

$releaseURL = "https://api.github.com/repos/bailey27/cppcryptfs/releases/latest"
$installPath = "C:\Program Files\CCPCryptFS"
$release = Invoke-RestMethod $releaseURL
$latestVersion = $release.tag_name
write-host "Latest Version: $latestVersion"
new-item -type Directory $installPath -force | out-null
foreach ($asset in $release.assets) {
$fileName = $asset.name
$downloadURL = $asset.browser_download_url
if ($fileName -like '*32.exe') {
continue
}
Invoke-WebRequest -URI $downloadURL -OutFile "$installPath\$fileName"
if ($fileName -like 'cppcryptfs.exe') {
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\$((Get-Item "$installPath\$fileName").Basename).lnk")
$Shortcut.TargetPath = "$installPath\$fileName"
$Shortcut.Save()
}
}