From 8e0804fc7ca1682c12392793bfac4a2bb2c6a256 Mon Sep 17 00:00:00 2001 From: PMMi11er Date: Fri, 29 Apr 2022 08:52:18 -0400 Subject: [PATCH] Update Arubu-Instant-On-HTML.ps1 Add logic to check and create report directory. Change hard path from New-HTML file path to use variable at top of the script. --- Aruba-Instant-On/Arubu-Instant-On-HTML.ps1 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Aruba-Instant-On/Arubu-Instant-On-HTML.ps1 b/Aruba-Instant-On/Arubu-Instant-On-HTML.ps1 index 4b88d3a..1114562 100644 --- a/Aruba-Instant-On/Arubu-Instant-On-HTML.ps1 +++ b/Aruba-Instant-On/Arubu-Instant-On-HTML.ps1 @@ -3,6 +3,18 @@ $ArubaInstantOnUser = 'api-user@yourdomain.com' $ArubaInstantOnPass = 'Make a long randomly generated password for the account that you save securely' +ReportRoot = "Directory to hold the report directory" +$ReportFolder = "Directory to place the report files" +$ReportPath = "$ReportRoot\$ReportFolder" + +#Check and create report path +$FolderExist = Test-Path -Path $ReportPath + +#If Folder doesn't exist - Make it +If ($FolderExist -eq $False){ + #Create Folder + New-Item -Path "$ReportRoot" -Name $ReportFolder -ItemType "directory" +} #### Functions #### @@ -164,7 +176,7 @@ foreach ($site in $sites.Elements) { # $ClientBlacklist = (Invoke-WebRequest -Method GET -Uri "https://nb.portal.arubainstanton.com/api/sites/$($Site.id)/clientBlacklist" -ContentType $ContentType -Headers $headers).content | ConvertFrom-Json # $applicationCategoryUsageConfiguration = (Invoke-WebRequest -Method GET -Uri "https://nb.portal.arubainstanton.com/api/sites/$($Site.id)/applicationCategoryUsageConfiguration" -ContentType $ContentType -Headers $headers).content | ConvertFrom-Json - New-HTML -Title 'Aruba Instant On Details' -FilePath "C:\Temp\ArubaION\$($Site.name).html" { + New-HTML -Title 'Aruba Instant On Details' -FilePath "$ReportPath\$($Site.name).html" { New-HTMLTAb -Name 'Site Summary' { New-HTMLSection -HeaderText 'Summary' { $LandingPage | Select-Object -ExcludeProperty kind | convertto-html -as list -Fragment