build most of Test-InternetBandwidth.ps1
small fix for Tools.ps1 and Uninstall-NCentralComponents.ps1
This commit is contained in:
@@ -0,0 +1,52 @@
|
|||||||
|
. 'C:\Users\dyoder\Emberkom\Data\Projects\development\management-scripts\Tools.ps1'
|
||||||
|
|
||||||
|
## Specify URL to SpeedTest CLI app
|
||||||
|
$URL = 'https://install.speedtest.net/app/cli/ookla-speedtest-1.0.0-win64.zip'
|
||||||
|
|
||||||
|
## Specify output file to write data to
|
||||||
|
$CurrentDateTime = Get-Date -Format "yyyyMMddHHmmssffff"
|
||||||
|
$OUTPUT = "${OutputDirectory}\${CurrentDateTime}_SpeedTest.csv"
|
||||||
|
|
||||||
|
## Download the app from the URL
|
||||||
|
$ZIPFILE = Download-File -URL $URL
|
||||||
|
|
||||||
|
## Setup the directory to extract the downloaded zip file to
|
||||||
|
$WORKINGDIR = $ZIPFILE.Substring(0, $ZIPFILE.LastIndexOf('.'))
|
||||||
|
If ( Test-Path $WORKINGDIR ) {
|
||||||
|
LogMsg "Deleting existing directory: ""$WORKINGDIR"""
|
||||||
|
Try { Remove-Item -Path $WORKINGDIR -Recurse -Force }
|
||||||
|
Catch { LogErr $_.Exception.Message }
|
||||||
|
}
|
||||||
|
LogMsg "Creating new directory: ""$WORKINGDIR"""
|
||||||
|
Try { New-Item -Path $WORKINGDIR -ItemType Directory -Force | Out-Null }
|
||||||
|
Catch { LogErr $_.Exception.Message }
|
||||||
|
|
||||||
|
## Extract $ZIPFILE to $WORKINGDIR
|
||||||
|
Try {
|
||||||
|
Add-Type -Assembly “System.IO.Compression.FileSystem”
|
||||||
|
[IO.Compression.ZipFile]::ExtractToDirectory($ZIPFILE, $WORKINGDIR)
|
||||||
|
}
|
||||||
|
Catch { LogErr $_.Exception.Message }
|
||||||
|
|
||||||
|
## Run the SpeedTest CLI app
|
||||||
|
$SPEEDTEST = "${WORKINGDIR}\speedtest.exe"
|
||||||
|
If ( Test-Path $SPEEDTEST ) {
|
||||||
|
Try { Start-Process $SPEEDTEST -ArgumentList "--progress=no --selection-details --output-header --format=csv" -PassThru -Wait -RedirectStandardOutput $OUTPUT }
|
||||||
|
Catch { LogErr $_.Exception.Message }
|
||||||
|
} Else { LogMsg "The file does not exist at the expected path: ""${SPEEDTEST}""" }
|
||||||
|
|
||||||
|
## Process the results
|
||||||
|
|
||||||
|
|
||||||
|
## Cleanup files and directories created by this script
|
||||||
|
If ( Test-Path $ZIPFILE ) {
|
||||||
|
LogMsg "Deleting downloaded zip file: ""$ZIPFILE"""
|
||||||
|
Try { Remove-Item -Path $ZIPFILE -Force }
|
||||||
|
Catch { LogErr $_.Exception.Message }
|
||||||
|
} Else { LogMsg "Downloaded zip file no longer exists: ""$ZIPFILE""" }
|
||||||
|
|
||||||
|
If ( Test-Path $WORKINGDIR ) {
|
||||||
|
LogMsg "Deleting directory from extracted zip file: ""$WORKINGDIR"""
|
||||||
|
Try { Remove-Item -Path $WORKINGDIR -Recurse -Force }
|
||||||
|
Catch { LogErr $_.Exception.Message }
|
||||||
|
} Else { LogMsg "Directory from extracted zip file no longer exists: ""$WORKINGDIR""" }
|
||||||
@@ -9,7 +9,7 @@ $ToolsDirectory = "${RootDirectory}\Tools"
|
|||||||
$LogsDirectory = "${RootDirectory}\Logs"
|
$LogsDirectory = "${RootDirectory}\Logs"
|
||||||
|
|
||||||
## Make sure all the management directories exist
|
## Make sure all the management directories exist
|
||||||
$RootDirectory, $ScriptsDirectory, $ToolsDirectory, $LogsDirectory | ForEach-Object {
|
$RootDirectory, $ScriptsDirectory, $OutputDirectory, $ToolsDirectory, $LogsDirectory | ForEach-Object {
|
||||||
If ( !(Test-Path $_) ) {
|
If ( !(Test-Path $_) ) {
|
||||||
Try { New-Item -Path $_ -ItemType Directory -Force -ErrorAction SilentlyContinue | Out-Null }
|
Try { New-Item -Path $_ -ItemType Directory -Force -ErrorAction SilentlyContinue | Out-Null }
|
||||||
Catch { Write-Output $_.Exception.Message }
|
Catch { Write-Output $_.Exception.Message }
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
## Remove N-Central Patch Management Service Controller
|
|
||||||
|
## Remove N-Central Patch Management Service Controller
|
||||||
If ( Test-Path "${Env:ProgramFiles(x86)}\MspPlatform\PME\unins000.exe" ) {
|
If ( Test-Path "${Env:ProgramFiles(x86)}\MspPlatform\PME\unins000.exe" ) {
|
||||||
LogMsg "Uninstalling N-Central Patch Management Service Controller"
|
LogMsg "Uninstalling N-Central Patch Management Service Controller"
|
||||||
Try { Start-Process "${Env:ProgramFiles(x86)}\MspPlatform\PME\unins000.exe" -ArgumentList "/SILENT" -Wait }
|
Try { Start-Process "${Env:ProgramFiles(x86)}\MspPlatform\PME\unins000.exe" -ArgumentList "/SILENT" -Wait }
|
||||||
|
|||||||
Reference in New Issue
Block a user