rmm-scripts/spacesniffer-deploy.ps1
2023-06-05 11:51:38 -07:00

24 lines
869 B
PowerShell

#zebra 5/23/23
#Deploys and runs SpaceSniffer. Defaults to C: Drive
#args: -drive <char>
[CmdletBinding()]
param (
[string]$drive = "C"
)
$folderPath = "C:\Ktemp\tools"
$downloadUrl = "https://git.izebra.xyz/Mirrored_Repos/SpaceSniffer/raw/branch/main/SpaceSniffer.exe"
$filePath = "C:\Ktemp\tools\SpaceSniffer.exe"
if(!(Test-Path -Path $folderPath -PathType Container))
{
New-Item -ItemType Directory -Path $folderPath | Out-Null
}
# Check if the file already exists
if (-not (Test-Path $filePath)) {
# Download the file using Invoke-WebRequest
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $downloadUrl -OutFile $filePath
}
C:\Ktemp\tools\SpaceSniffer.exe /S scan $drive export "SpaceSniffer binary snapshot" "C:\Ktemp\tools\SpaceSniffer-$(get-date -f yyyy-MM-dd-hh-mm-ss).sns" autoclose