installUnifi.psm1
function Install-Unifi { Clear-Host # Run script as Administrator (Required for directory access) #if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit } if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Write-Warning "Install-Unifi must be run from a PowerShell window as Administrator." ; Pause ; Exit} # Import Utility Functions . $PSScriptRoot\Private\scriptFunctions.ps1 # Set Unifi Directory $unifiDirectory = "C:\Program Files\Ubiquiti Unifi" Write-Verbose $unifiDirectory getUnifi Write-Host "" Pause } |