diff --git a/uberAgentSupport-dev/Private/Compress-uAArchive.ps1 b/uberAgentSupport-dev/Private/Compress-uAArchive.ps1 index a1e2ec5..8e83d8b 100644 --- a/uberAgentSupport-dev/Private/Compress-uAArchive.ps1 +++ b/uberAgentSupport-dev/Private/Compress-uAArchive.ps1 @@ -22,14 +22,25 @@ Function Compress-uAArchive{ $shellApplication = new-object -com shell.application $zipPackage = $shellApplication.NameSpace($ZipFile) - $files = Get-ChildItem -Path $SourceDir + $items = Get-ChildItem -Path $SourceDir - foreach($file in $files) { - $zipPackage.CopyHere($file.FullName) - #using this method, sometimes files can be 'skipped' - #this 'while' loop checks each file is added before moving to the next - while($null -eq $zipPackage.Items().Item($file.name)){ - Start-sleep -seconds 1 + foreach ($item in $items) { + if ($item.PSIsContainer) { + $files = Get-ChildItem -Path $item.FullName + if ($files.Count -eq 0) { + Write-Verbose "Skipping empty folder: $($item.FullName)" + continue + } + } + + try { + $zipPackage.CopyHere($item.FullName) + } catch { + Write-Error "Failed to copy $($item.FullName) to the zip package." + } + + while ($null -eq $zipPackage.Items().Item($item.Name)) { + Start-Sleep -Seconds 1 } } } \ No newline at end of file diff --git a/uberAgentSupport-dev/Private/Copy-uAItem.ps1 b/uberAgentSupport-dev/Private/Copy-uAItem.ps1 index 56ae07e..f137dee 100644 --- a/uberAgentSupport-dev/Private/Copy-uAItem.ps1 +++ b/uberAgentSupport-dev/Private/Copy-uAItem.ps1 @@ -1,3 +1,21 @@ +Function Test-IsAbsolutePath { + PARAM ( + [Parameter(Mandatory = $True, Position = 0)] + [string]$Path + ) + + if ($null -eq $Path -or $Path -eq "") { + return $false + } + + # Test if the path is absolute + if ($Path -match '^[a-zA-Z]:\\' -or $Path.StartsWith('/')) { + return $true + } + + return $false +} + Function Copy-uAItem { PARAM( [Parameter(Mandatory = $True, Position = 0)] @@ -16,6 +34,17 @@ Function Copy-uAItem { $DestinationDirectory = $Destination } + # Check if the paths are absolute + if ((Test-IsAbsolutePath -Path $Source) -ne $true) { + Write-Warning "The Source path '$Source' is not an absolute path. Skipping copy action." + return + } + + if ((Test-IsAbsolutePath -Path $Destination) -ne $true) { + Write-Warning "The Destination path '$Destination' is not an absolute path. Skipping copy action." + return + } + # If the destination directory doesn't exist, create it if (-not (Test-Path $DestinationDirectory)) { New-Item -ItemType Directory -Path $DestinationDirectory -Force | Out-Null @@ -36,6 +65,6 @@ Function Copy-uAItem { Copy-Item @copyItemParams } Else { - Write-Warning "There is no file '$Source'" + Write-Warning "The Source path '$Source' does not exist." } } \ No newline at end of file diff --git a/uberAgentSupport-dev/Public/New-uASupportBundle.ps1 b/uberAgentSupport-dev/Public/New-uASupportBundle.ps1 index 220d1e8..f5bf9bf 100644 --- a/uberAgentSupport-dev/Public/New-uASupportBundle.ps1 +++ b/uberAgentSupport-dev/Public/New-uASupportBundle.ps1 @@ -15,14 +15,18 @@ Function New-uASupportBundle { # Evaluate log file path $null = $LogPath - $LogPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Policies\vast limits\uberAgent\LogConfig" -Name LogPath -ErrorAction SilentlyContinue - if (-not $LogPath) - { - Write-Verbose "LogPath not found in 'HKLM:\SOFTWARE\Policies\vast limits\uberAgent\LogConfig'. Trying 'HKLM:\SOFTWARE\vast limits\uberAgent\LogConfig'." -Verbose - $LogPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\vast limits\uberAgent\LogConfig" -Name LogPath -ErrorAction SilentlyContinue + if (Test-Path "HKLM:\SOFTWARE\Policies\vast limits\uberAgent\LogConfig") { + $LogPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Policies\vast limits\uberAgent\LogConfig" -Name LogPath -ErrorAction SilentlyContinue } - else - { + if (-not $LogPath) { + if (Test-Path "HKLM:\SOFTWARE\vast limits\uberAgent\LogConfig") { + $LogPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\vast limits\uberAgent\LogConfig" -Name LogPath -ErrorAction SilentlyContinue + } + else { + Write-Verbose "LogPath not found in 'HKLM:\SOFTWARE\Policies\vast limits\uberAgent\LogConfig'. Trying 'HKLM:\SOFTWARE\vast limits\uberAgent\LogConfig'." -Verbose + } + } + else { Write-Verbose "LogPath found in 'HKLM:\SOFTWARE\Policies\vast limits\uberAgent\LogConfig'." -Verbose } if (-not $LogPath) @@ -32,8 +36,9 @@ Function New-uASupportBundle { } else { - Write-Verbose "LogPath found in 'HKLM:\SOFTWARE\vast limits\uberAgent\LogConfig'." -Verbose + Write-Verbose "LogPath found in 'HKLM:\SOFTWARE\Policies\vast limits\uberAgent\LogConfig'." -Verbose } + $ResolvedLogPath = [System.Environment]::ExpandEnvironmentVariables($LogPath) Write-Verbose "Resolved log path: $ResolvedLogPath" -Verbose @@ -43,13 +48,18 @@ Function New-uASupportBundle { Throw "Log path '$ResolvedLogPath' not found. Please check the log path configuration or verify that you have the permissions to access the log path." } - $uAServiceLogs = "$ResolvedLogPath\uberAgent*.log" - $uAServiceConfigurationLogs = "$ResolvedLogPath\uberAgentConfiguration*.log" - $uAInSessionHelperLog = "$ResolvedLogPath\uAInSessionHelper.log" + $uAServiceLogs = [System.IO.Path]::Combine($ResolvedLogPath, "uberAgent*.log") + $uAServiceConfigurationLogs = [System.IO.Path]::Combine($ResolvedLogPath, "uberAgentServiceConfig*.log") + if (Test-Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList') { + $ProfilesDirectory = Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' -Name ProfilesDirectory + } else { + Throw "Registry key 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' not found." + } + $uAInSessionHelperLog = [System.IO.Path]::Combine($ResolvedLogPath, "uAInSessionHelper.log") $ProfilesDirectory = Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' -Name ProfilesDirectory $UserProfiles = (Get-ChildItem -Path $ProfilesDirectory -Directory -Exclude 'Public').Name - $WorkingDirectory = "$env:temp\uASupport" - $PowerShellLog = "$WorkingDirectory\PowerShellTranskript.log" + $WorkingDirectory = [System.IO.Path]::Combine($env:temp, "uASupport") + $PowerShellLog = [System.IO.Path]::Combine($WorkingDirectory, "PowerShellTranskript.log") $OperatingSystem = (Get-CimInstance -Class Win32_OperatingSystem).caption $DesktopPath = [Environment]::GetFolderPath('Desktop') $OSBitness = $env:PROCESSOR_ARCHITECTURE @@ -140,33 +150,52 @@ Function New-uASupportBundle { Copy-uAItem -Source $uAInSessionHelperLog -Destination "$WorkingDirectory\uAInSessionHelper" Write-Verbose 'Collect Chrome/Firefox browser extension in-session helper logs for all sessions' -Verbose + + foreach ($UserProfile in $UserProfiles) { - Copy-uAItem -Source "$ProfilesDirectory\$UserProfile\AppData\Local\Temp\uAInSessionHelper.log" -Destination "$WorkingDirectory\Browser\uAInSessionHelper-$UserProfile.log" + $src = [System.IO.Path]::Combine($ProfilesDirectory, $UserProfile, "AppData\Local\Temp\uAInSessionHelper.log") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Browser", "uAInSessionHelper-$UserProfile.log") + + Copy-uAItem -Source $src -Destination $dst } Write-Verbose 'Collect Internet Explorer add-on log' -Verbose foreach ($UserProfile in $UserProfiles) { - Copy-uAItem -Source "$ProfilesDirectory\$UserProfile\AppData\Local\Temp\Low\uberAgentIEExtension.log" -Destination "$WorkingDirectory\Browser\uberAgentIEExtension-$UserProfile.log" + $src = [System.IO.Path]::Combine($ProfilesDirectory, $UserProfile, "AppData\Local\Temp\Low\uberAgentIEExtension.log") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Browser", "uberAgentIEExtension-$UserProfile.log") + Copy-uAItem -Source $src -Destination $dst } Write-Verbose 'Collect Internet Explorer add-on log - Enhanced Protection Mode' -Verbose If ($OperatingSystem -match 'Microsoft Windows 7') { foreach ($UserProfile in $UserProfiles) { - Copy-uAItem -Source "$ProfilesDirectory\$UserProfile\AppData\Local\Temp\Low\uberAgentIEExtension.log" -Destination "$WorkingDirectory\Browser\uberAgentIEExtension-EPM-$UserProfile.log" + $src = [System.IO.Path]::Combine($ProfilesDirectory, $UserProfile, "AppData\Local\Temp\Low\uberAgentIEExtension.log") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Browser", "uberAgentIEExtension-EPM-$UserProfile.log") + Copy-uAItem -Source $src -Destination $dst } } Else { foreach ($UserProfile in $UserProfiles) { - Copy-uAItem -Source "$ProfilesDirectory\$UserProfile\AppData\Local\Packages\windows_ie_ac_001\AC\Temp\uberAgentIEExtension.log" -Destination "$WorkingDirectory\Browser\uberAgentIEExtension-EPM-$UserProfile.log" + $src = [System.IO.Path]::Combine($ProfilesDirectory, $UserProfile, "AppData\Local\Packages\windows_ie_ac_001\AC\Temp\uberAgentIEExtension.log") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Browser", "uberAgentIEExtension-EPM-$UserProfile.log") + Copy-uAItem -Source $src -Destination $dst } } If($SplunkUFinstalled) { Write-Verbose 'Collect Splunk Universal Forwarder logs' -Verbose - Copy-uAItem -Source "$SplunkUFInstallDir\var\log\splunk\splunkd.log" -Destination "$WorkingDirectory\SplunkUniversalForwarder\splunkd.log" - Copy-uAItem -Source "$SplunkUFInstallDir\var\log\splunk\metrics.log" -Destination "$WorkingDirectory\SplunkUniversalForwarder\metrics.log" + + $src = [System.IO.Path]::Combine($SplunkUFInstallDir, "var\log\splunk\splunkd.log") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "SplunkUniversalForwarder", "splunkd.log") + Copy-uAItem -Source $src -Destination $dst + + $src = [System.IO.Path]::Combine($SplunkUFInstallDir, "var\log\splunk\metrics.log") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "SplunkUniversalForwarder", "metrics.log") + Copy-uAItem -Source $src -Destination $dst + Write-Verbose 'Performing uberAgent to Splunk Universal Forwarder connection check' -Verbose - Get-NetTCPConnection | Format-Table LocalAddress, LocalPort, RemoteAddress, RemotePort, State, OwningProcess | Out-File -FilePath "$WorkingDirectory\SplunkUniversalForwarder\Get-NetTCPConnection.log" + $dst = [System.IO.Path]::Combine($WorkingDirectory, "SplunkUniversalForwarder", "Get-NetTCPConnection.log") + Get-NetTCPConnection | Format-Table LocalAddress, LocalPort, RemoteAddress, RemotePort, State, OwningProcess | Out-File -FilePath $dst } #endregion log files @@ -174,15 +203,22 @@ Function New-uASupportBundle { Write-Verbose 'Collect uberAgent configuration files' -Verbose New-Item -Path "$WorkingDirectory" -Name Config -ItemType Directory | Out-Null - Copy-uAItem -Source "$env:programdata\vast limits\uberAgent\Configuration\*" -Destination "$WorkingDirectory\Config\ProgramData" -Recurse -Exclude $ExcludeExecutablesAndLibraries - Copy-uAItem -Source "$uberAgentInstallDir\*" -Destination "$WorkingDirectory\Config\ProgramFiles" -Recurse -Exclude $ExcludeExecutablesAndLibraries + $src = [System.IO.Path]::Combine($env:programdata, "vast limits\uberAgent\Configuration\*") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Config\ProgramData") + Copy-uAItem -Source $src -Destination $dst -Recurse -Exclude $ExcludeExecutablesAndLibraries + + $src = [System.IO.Path]::Combine($uberAgentInstallDir, "*") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Config\ProgramFiles") + Copy-uAItem -Source $src -Destination $dst -Recurse -Exclude $ExcludeExecutablesAndLibraries if ((Get-ItemProperty -Path "HKLM:\SOFTWARE\vast limits\uberAgent\Config" -Name ConfigFilePath -ErrorAction SilentlyContinue) -OR (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\vast limits\uberAgent\Config" -Name ConfigFilePath -ErrorAction SilentlyContinue)) { # CCFM is active $ConfigCachePath = (Get-ItemProperty -Path "HKLM:\SOFTWARE\vast limits\uberAgent\CCFM" -Name ConfigCachePath).ConfigCachePath if ($ConfigCachePath) { - Copy-uAItem -Source "$ConfigCachePath\*" -Destination "$WorkingDirectory\Config\CCFM" -Recurse -Exclude $ExcludeExecutablesAndLibraries + $src = [System.IO.Path]::Combine($ConfigCachePath, "*") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Config\CCFM") + Copy-uAItem -Source $src -Destination $dst -Recurse -Exclude $ExcludeExecutablesAndLibraries } else { Write-Warning "ConfigFilePath is set but ConfigCachePath is not. CCFM config is broken." @@ -192,8 +228,14 @@ Function New-uASupportBundle { If($SplunkUFinstalled) { Write-Verbose 'Collect Splunk Universal Forwarder configuration files' -Verbose - Copy-uAItem -Source "$SplunkUFInstallDir\etc\system\local\inputs.conf" -Destination "$WorkingDirectory\SplunkUniversalForwarder\inputs.conf" - Copy-uAItem -Source "$SplunkUFInstallDir\etc\system\local\outputs.conf" -Destination "$WorkingDirectory\SplunkUniversalForwarder\outputs.conf" + + $src = [System.IO.Path]::Combine($SplunkUFInstallDir, "etc\system\local\inputs.conf") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "SplunkUniversalForwarder", "inputs.conf") + Copy-uAItem -Source $src -Destination $dst + + $src = [System.IO.Path]::Combine($SplunkUFInstallDir, "etc\system\local\outputs.conf") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "SplunkUniversalForwarder", "outputs.conf") + Copy-uAItem -Source $src -Destination $dst } #endregion config files @@ -209,7 +251,9 @@ Function New-uASupportBundle { Foreach ($RegKey in $RegKeys) { $RegKeyContent = Get-uARegistryItem -Key "$($RegKey.Path)" $RegKeyComponent = "$($RegKey.Component)" - Out-File -FilePath "$WorkingDirectory\Registry\$RegKeyComponent registry keys.txt" -InputObject $RegKeyContent -Append -NoClobber + + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Registry", "$RegKeyComponent registry keys.txt") + Out-File -FilePath $dst -InputObject $RegKeyContent -Append -NoClobber } #endregion registry @@ -218,8 +262,12 @@ Function New-uASupportBundle { New-Item -Path "$WorkingDirectory\Processes" -ItemType Directory | Out-Null Foreach ($Process in $Processes) { $ProcessDetail = Get-uAProcessDetails -ProcessName $Process + Write-Verbose "Collect details for process $Process" - Out-File -FilePath "$WorkingDirectory\Processes\Process details.txt" -InputObject $ProcessDetail -Append -NoClobber + + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Processes", "Process details.txt") + + Out-File -FilePath $dst -InputObject $ProcessDetail -Append -NoClobber } #endregion processes @@ -227,6 +275,7 @@ Function New-uASupportBundle { Write-Verbose 'Create support zip file' -Verbose $CurrentDate = Get-Date -Format "yyyy-MM-dd HH-mm-ss" $ZipFilename = 'uASupportBundle-' + "$env:COMPUTERNAME" + '-' + "$CurrentDate" + '.zip' + Compress-uAArchive -SourceDir $WorkingDirectory -ZipFilename $ZipFilename -ZipFilepath $DesktopPath Write-Verbose "Successfully created uberAgent support bundle at $(Join-Path $DesktopPath $ZipFilename)" -Verbose #endregion zip file @@ -242,10 +291,18 @@ Function New-uASupportBundle { $stopWatch.Stop() Write-Verbose "Elapsed Runtime: $($stopWatch.Elapsed.Minutes) minutes and $($stopWatch.Elapsed.Seconds) seconds." -Verbose Stop-Transcript | Out-Null + # Delete old working folder if any If (Test-Path $WorkingDirectory) { - Remove-Item $WorkingDirectory -Force -Recurse -ErrorAction Stop - Write-Verbose "Successfully deleted working directory '$WorkingDirectory'" + + if ((Test-IsAbsolutePath -Path $WorkingDirectory) -eq $true) { + Remove-Item $WorkingDirectory -Force -Recurse -ErrorAction Stop + Write-Verbose "Successfully deleted working directory '$WorkingDirectory'" + } + else { + Write-Error "Failed to delete working directory '$WorkingDirectory'" + } + } } } diff --git a/uberAgentSupport-dev/uberAgentSupport.psd1 b/uberAgentSupport-dev/uberAgentSupport.psd1 index 3074ad9..262d487 100644 --- a/uberAgentSupport-dev/uberAgentSupport.psd1 +++ b/uberAgentSupport-dev/uberAgentSupport.psd1 @@ -12,7 +12,7 @@ RootModule = 'uberAgentSupport.psm1' # Version number of this module. - ModuleVersion = '1.3.1' + ModuleVersion = '1.3.2' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/uberAgentSupport/Private/Compress-uAArchive.ps1 b/uberAgentSupport/Private/Compress-uAArchive.ps1 index 1328a9c..4591518 100644 --- a/uberAgentSupport/Private/Compress-uAArchive.ps1 +++ b/uberAgentSupport/Private/Compress-uAArchive.ps1 @@ -22,22 +22,33 @@ Function Compress-uAArchive{ $shellApplication = new-object -com shell.application $zipPackage = $shellApplication.NameSpace($ZipFile) - $files = Get-ChildItem -Path $SourceDir + $items = Get-ChildItem -Path $SourceDir - foreach($file in $files) { - $zipPackage.CopyHere($file.FullName) - #using this method, sometimes files can be 'skipped' - #this 'while' loop checks each file is added before moving to the next - while($null -eq $zipPackage.Items().Item($file.name)){ - Start-sleep -seconds 1 + foreach ($item in $items) { + if ($item.PSIsContainer) { + $files = Get-ChildItem -Path $item.FullName + if ($files.Count -eq 0) { + Write-Verbose "Skipping empty folder: $($item.FullName)" + continue + } + } + + try { + $zipPackage.CopyHere($item.FullName) + } catch { + Write-Error "Failed to copy $($item.FullName) to the zip package." + } + + while ($null -eq $zipPackage.Items().Item($item.Name)) { + Start-Sleep -Seconds 1 } } } # SIG # Begin signature block # MIIRVgYJKoZIhvcNAQcCoIIRRzCCEUMCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBIzKMDSx2RaqtR -# W++II9n9bf06IHgEQzThbBsg9ZMRp6CCDW0wggZyMIIEWqADAgECAghkM1HTxzif +# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCCHqmeJfmOpG0zC +# zKlnRsF3v6rhg3yRIxv6I9v4gm76+6CCDW0wggZyMIIEWqADAgECAghkM1HTxzif # CDANBgkqhkiG9w0BAQsFADB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx # EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8G # A1UEAwwoU1NMLmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTAe @@ -114,17 +125,17 @@ Function Compress-uAArchive{ # BAMMK1NTTC5jb20gQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBDQSBSU0EgUjEC # EH2BzCLRJ8FqayiMJpFZrFQwDQYJYIZIAWUDBAIBBQCggYQwGAYKKwYBBAGCNwIB # DDEKMAigAoAAoQKAADAZBgkqhkiG9w0BCQMxDAYKKwYBBAGCNwIBBDAcBgorBgEE -# AYI3AgELMQ4wDAYKKwYBBAGCNwIBFTAvBgkqhkiG9w0BCQQxIgQg3O29mRQxp2oZ -# IHFcJu/hBINETVJzcgsAKDd1CE90sU0wDQYJKoZIhvcNAQEBBQAEggIAMaYFELfT -# oPiVYoosR4hHKxXkCCd3I2QiQtbBINlIb3dVhL7B6ZZvinTYUL7Is8KacRJqZ9G+ -# yYkX4dB0vzetNpIz4gbvKLI7nQH47N7j5O1Wze2dqBAlrvXeqHugT1OdFEiWYP/I -# EMQa3yethMI3weyFYCvGAELCjbm78HVG6c3KWh5jkEVs3bDuIhOdnywAJdAjqT4f -# hn1C9WdPXnLYnz5L7QIgo0wLLgi75REpj5Puaskbh56+spQIgbxJlbgnyFxYlSeK -# oVmlPXwlYHQOPi4tkDarWrnqpjeDTVTOepgIU7zI53jIz7hlmHX6vTzfSG22R1iH -# v7NCXf3TUrE901Nw0LowO449HicAZwTmP5y1z4Y50WO+vtkl6HRMoqLQnqpb3RIu -# Snqo6TxasAfamDp9qP7QTncu5XnWAfXD1BZsI33UFJvg7GbPv8UIkF4IwD2FMWnP -# f2sknJglfGF40Ir1QT1XzEJEYpqhtVk98Myagl6AWPC+stFQlTfmcH3NOuwIM7Re -# k9HN9c/BpPrhoLdo1IlLxGiq12LiwL4zfFxV66dX5BLiiwGOT1ydRs/iEHYxuXKb -# uu8/pXEsbkBNdWmQOssl0ukzsXGVzCWGvvwoVyJyDVxmU3w2/IR2zi3fis1mQzjJ -# w06TT5CN5jjARPg34CukaGtPg6c+7nLROX4= +# AYI3AgELMQ4wDAYKKwYBBAGCNwIBFTAvBgkqhkiG9w0BCQQxIgQgiY/23q89AXlm +# 2+cQZAQOSy/oeIeaWTQieTSQYc+TEX4wDQYJKoZIhvcNAQEBBQAEggIAfbpdN6Py +# A1SVkwO627MBx+lTRBTQzes+UiPJZRdBVNhAKx+qMdXD2E2mK0C/Sco4JYW3y/Xo +# dh0BaSaAZf1QPyE4was9DgvCE1hGHQvsNaENJ6NiYAMAX3Vcag2urOGNF+NTJyPq +# 7RUtGFLFitBhd7nrrYAUY6v+4oegzXXX0A2LOv1FSVS4tiZH/cqblWA7ZzIG6VIF +# dPCcUXTkauJdeSiqHI+hSH7QBo3roY09VELRL7CZG5ykfKQLsdnkubLTV4CeeMPz +# M42MufeVioW4lT4h9Ax8BeXcbnqkvxg4pzZu0rNUKl2tGDuehvujwdBSg3IGG84p +# jMyMh6ndFUAVrpgKSoi09UsWSmfK6CMqWieDnSFiGvPdY2s7iKdQ282X5f+Hmd4P +# wayFJXJfSLs7viSIKwG7MiOFdhVVKRTgQzZNW26BDfVF1XIVJUt+P3B1RcBBVD/V +# l8EGDl+xtErdSmQtjhy+M2HtS2sONkuDrb/wJ8xoIVrwMLuBrwJkf/KcByLGoHIu +# wQq/VVEsDc8Tcu5I9W7ijZTZebeCoypBWNeNTwiU+drQ1QpP+oCZNXlhiDMQdSxs +# g7+DoSAy4ygN2GVIuNbncOuGyAgDzvHp7uB7pQuC+mjsXDA2f8waGb5XBRgxHwt/ +# ehGBdTu9YIsRw+e7tWT5txmSUjupnAMKiJg= # SIG # End signature block diff --git a/uberAgentSupport/Private/Copy-uAItem.ps1 b/uberAgentSupport/Private/Copy-uAItem.ps1 index 3e61972..2f13b58 100644 --- a/uberAgentSupport/Private/Copy-uAItem.ps1 +++ b/uberAgentSupport/Private/Copy-uAItem.ps1 @@ -1,3 +1,21 @@ +Function Test-IsAbsolutePath { + PARAM ( + [Parameter(Mandatory = $True, Position = 0)] + [string]$Path + ) + + if ($null -eq $Path -or $Path -eq "") { + return $false + } + + # Test if the path is absolute + if ($Path -match '^[a-zA-Z]:\\' -or $Path.StartsWith('/')) { + return $true + } + + return $false +} + Function Copy-uAItem { PARAM( [Parameter(Mandatory = $True, Position = 0)] @@ -16,6 +34,17 @@ Function Copy-uAItem { $DestinationDirectory = $Destination } + # Check if the paths are absolute + if ((Test-IsAbsolutePath -Path $Source) -ne $true) { + Write-Warning "The Source path '$Source' is not an absolute path. Skipping copy action." + return + } + + if ((Test-IsAbsolutePath -Path $Destination) -ne $true) { + Write-Warning "The Destination path '$Destination' is not an absolute path. Skipping copy action." + return + } + # If the destination directory doesn't exist, create it if (-not (Test-Path $DestinationDirectory)) { New-Item -ItemType Directory -Path $DestinationDirectory -Force | Out-Null @@ -36,14 +65,14 @@ Function Copy-uAItem { Copy-Item @copyItemParams } Else { - Write-Warning "There is no file '$Source'" + Write-Warning "The Source path '$Source' does not exist." } } # SIG # Begin signature block # MIIRVgYJKoZIhvcNAQcCoIIRRzCCEUMCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDMGiMJ/X6tnHVm -# dqVzx/qoDLUzedRdyYhfAbKHQH+5LqCCDW0wggZyMIIEWqADAgECAghkM1HTxzif +# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDYcpHstsPN6f+0 +# fKeV5ntkI3vCayyDU49uNUpYgAMLmKCCDW0wggZyMIIEWqADAgECAghkM1HTxzif # CDANBgkqhkiG9w0BAQsFADB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx # EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8G # A1UEAwwoU1NMLmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTAe @@ -120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MQ4wDAYKKwYBBAGCNwIBFTAvBgkqhkiG9w0BCQQxIgQgfDiE6MjRCAay +# UYpfNUCR1rgttaNYnPCzB1NfE1tFGEgwDQYJKoZIhvcNAQEBBQAEggIAkcnedMPX +# exhB4Oii3WbB9f8Yb5kgOBtYg9NGaUHF8+jfelbi35o//Dae1FHUFGcLQ9IpPHdV +# 4r5OH9NPqNhHfiEbFJjJu5/wsOt9j4ZN6TPaBUa9Q1pZ8MinldfNRIt4Eyt4EqRK +# 6TIrDzKn0Ta/pHIe32sWpb1BAuGqJ08avvsFGNEZ6W+CxZQlLVEn/9XDeztTYzPp +# UQdiAdD1d6ADoi+uV7Ihx2Xk25aJzCn/1aSnGuUT+0bQdnS7nJqH4e9NKoiPTFZ7 +# lXwOmm32AmhYjRhPcsgmfkL9vEbWXgq1IOJOEm97XNNf1bgvC0odHoCIgm2o+/fW +# 1nOP6j982yxCt1TgZmTIyR0ZDSLKpQvn4pSNwgkCY1d3jHL5lebNIEZY/rP9XYVE +# jsG5FKr0B7+F9k6US/7CelcYRZnFTv+2J76BWx8esHp2NtQUyZdsE/NWOOWeQgqL +# u5Grm1+iGlWLF4JU8gNvLST0rtMB86Hjs4W804ybZQHR814+w5jpwQGYGJDrqPa/ +# +ISIc6oFhFdgUSGDzEbu2QuIrEmnFjPoaYQ+PbCZMPmISvFi7As7k0RvuRrr6rtf +# HxgNvWGiTolWBxciq5F2Q51oCuoyV3X3YDfo2/J1qjrJa2g6YsvB56QIfCJvhotm +# bwKFtWBPIR8kiC3ox3/Y7DrFDZu03ZQ56yg= # SIG # End signature block diff --git a/uberAgentSupport/Public/New-uASupportBundle.ps1 b/uberAgentSupport/Public/New-uASupportBundle.ps1 index 72a294c..92104c6 100644 --- a/uberAgentSupport/Public/New-uASupportBundle.ps1 +++ b/uberAgentSupport/Public/New-uASupportBundle.ps1 @@ -15,14 +15,18 @@ Function New-uASupportBundle { # Evaluate log file path $null = $LogPath - $LogPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Policies\vast limits\uberAgent\LogConfig" -Name LogPath -ErrorAction SilentlyContinue - if (-not $LogPath) - { - Write-Verbose "LogPath not found in 'HKLM:\SOFTWARE\Policies\vast limits\uberAgent\LogConfig'. Trying 'HKLM:\SOFTWARE\vast limits\uberAgent\LogConfig'." -Verbose - $LogPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\vast limits\uberAgent\LogConfig" -Name LogPath -ErrorAction SilentlyContinue + if (Test-Path "HKLM:\SOFTWARE\Policies\vast limits\uberAgent\LogConfig") { + $LogPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Policies\vast limits\uberAgent\LogConfig" -Name LogPath -ErrorAction SilentlyContinue } - else - { + if (-not $LogPath) { + if (Test-Path "HKLM:\SOFTWARE\vast limits\uberAgent\LogConfig") { + $LogPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\vast limits\uberAgent\LogConfig" -Name LogPath -ErrorAction SilentlyContinue + } + else { + Write-Verbose "LogPath not found in 'HKLM:\SOFTWARE\Policies\vast limits\uberAgent\LogConfig'. Trying 'HKLM:\SOFTWARE\vast limits\uberAgent\LogConfig'." -Verbose + } + } + else { Write-Verbose "LogPath found in 'HKLM:\SOFTWARE\Policies\vast limits\uberAgent\LogConfig'." -Verbose } if (-not $LogPath) @@ -32,8 +36,9 @@ Function New-uASupportBundle { } else { - Write-Verbose "LogPath found in 'HKLM:\SOFTWARE\vast limits\uberAgent\LogConfig'." -Verbose + Write-Verbose "LogPath found in 'HKLM:\SOFTWARE\Policies\vast limits\uberAgent\LogConfig'." -Verbose } + $ResolvedLogPath = [System.Environment]::ExpandEnvironmentVariables($LogPath) Write-Verbose "Resolved log path: $ResolvedLogPath" -Verbose @@ -43,13 +48,18 @@ Function New-uASupportBundle { Throw "Log path '$ResolvedLogPath' not found. Please check the log path configuration or verify that you have the permissions to access the log path." } - $uAServiceLogs = "$ResolvedLogPath\uberAgent*.log" - $uAServiceConfigurationLogs = "$ResolvedLogPath\uberAgentConfiguration*.log" - $uAInSessionHelperLog = "$ResolvedLogPath\uAInSessionHelper.log" + $uAServiceLogs = [System.IO.Path]::Combine($ResolvedLogPath, "uberAgent*.log") + $uAServiceConfigurationLogs = [System.IO.Path]::Combine($ResolvedLogPath, "uberAgentServiceConfig*.log") + if (Test-Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList') { + $ProfilesDirectory = Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' -Name ProfilesDirectory + } else { + Throw "Registry key 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' not found." + } + $uAInSessionHelperLog = [System.IO.Path]::Combine($ResolvedLogPath, "uAInSessionHelper.log") $ProfilesDirectory = Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' -Name ProfilesDirectory $UserProfiles = (Get-ChildItem -Path $ProfilesDirectory -Directory -Exclude 'Public').Name - $WorkingDirectory = "$env:temp\uASupport" - $PowerShellLog = "$WorkingDirectory\PowerShellTranskript.log" + $WorkingDirectory = [System.IO.Path]::Combine($env:temp, "uASupport") + $PowerShellLog = [System.IO.Path]::Combine($WorkingDirectory, "PowerShellTranskript.log") $OperatingSystem = (Get-CimInstance -Class Win32_OperatingSystem).caption $DesktopPath = [Environment]::GetFolderPath('Desktop') $OSBitness = $env:PROCESSOR_ARCHITECTURE @@ -140,33 +150,52 @@ Function New-uASupportBundle { Copy-uAItem -Source $uAInSessionHelperLog -Destination "$WorkingDirectory\uAInSessionHelper" Write-Verbose 'Collect Chrome/Firefox browser extension in-session helper logs for all sessions' -Verbose + + foreach ($UserProfile in $UserProfiles) { - Copy-uAItem -Source "$ProfilesDirectory\$UserProfile\AppData\Local\Temp\uAInSessionHelper.log" -Destination "$WorkingDirectory\Browser\uAInSessionHelper-$UserProfile.log" + $src = [System.IO.Path]::Combine($ProfilesDirectory, $UserProfile, "AppData\Local\Temp\uAInSessionHelper.log") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Browser", "uAInSessionHelper-$UserProfile.log") + + Copy-uAItem -Source $src -Destination $dst } Write-Verbose 'Collect Internet Explorer add-on log' -Verbose foreach ($UserProfile in $UserProfiles) { - Copy-uAItem -Source "$ProfilesDirectory\$UserProfile\AppData\Local\Temp\Low\uberAgentIEExtension.log" -Destination "$WorkingDirectory\Browser\uberAgentIEExtension-$UserProfile.log" + $src = [System.IO.Path]::Combine($ProfilesDirectory, $UserProfile, "AppData\Local\Temp\Low\uberAgentIEExtension.log") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Browser", "uberAgentIEExtension-$UserProfile.log") + Copy-uAItem -Source $src -Destination $dst } Write-Verbose 'Collect Internet Explorer add-on log - Enhanced Protection Mode' -Verbose If ($OperatingSystem -match 'Microsoft Windows 7') { foreach ($UserProfile in $UserProfiles) { - Copy-uAItem -Source "$ProfilesDirectory\$UserProfile\AppData\Local\Temp\Low\uberAgentIEExtension.log" -Destination "$WorkingDirectory\Browser\uberAgentIEExtension-EPM-$UserProfile.log" + $src = [System.IO.Path]::Combine($ProfilesDirectory, $UserProfile, "AppData\Local\Temp\Low\uberAgentIEExtension.log") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Browser", "uberAgentIEExtension-EPM-$UserProfile.log") + Copy-uAItem -Source $src -Destination $dst } } Else { foreach ($UserProfile in $UserProfiles) { - Copy-uAItem -Source "$ProfilesDirectory\$UserProfile\AppData\Local\Packages\windows_ie_ac_001\AC\Temp\uberAgentIEExtension.log" -Destination "$WorkingDirectory\Browser\uberAgentIEExtension-EPM-$UserProfile.log" + $src = [System.IO.Path]::Combine($ProfilesDirectory, $UserProfile, "AppData\Local\Packages\windows_ie_ac_001\AC\Temp\uberAgentIEExtension.log") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Browser", "uberAgentIEExtension-EPM-$UserProfile.log") + Copy-uAItem -Source $src -Destination $dst } } If($SplunkUFinstalled) { Write-Verbose 'Collect Splunk Universal Forwarder logs' -Verbose - Copy-uAItem -Source "$SplunkUFInstallDir\var\log\splunk\splunkd.log" -Destination "$WorkingDirectory\SplunkUniversalForwarder\splunkd.log" - Copy-uAItem -Source "$SplunkUFInstallDir\var\log\splunk\metrics.log" -Destination "$WorkingDirectory\SplunkUniversalForwarder\metrics.log" + + $src = [System.IO.Path]::Combine($SplunkUFInstallDir, "var\log\splunk\splunkd.log") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "SplunkUniversalForwarder", "splunkd.log") + Copy-uAItem -Source $src -Destination $dst + + $src = [System.IO.Path]::Combine($SplunkUFInstallDir, "var\log\splunk\metrics.log") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "SplunkUniversalForwarder", "metrics.log") + Copy-uAItem -Source $src -Destination $dst + Write-Verbose 'Performing uberAgent to Splunk Universal Forwarder connection check' -Verbose - Get-NetTCPConnection | Format-Table LocalAddress, LocalPort, RemoteAddress, RemotePort, State, OwningProcess | Out-File -FilePath "$WorkingDirectory\SplunkUniversalForwarder\Get-NetTCPConnection.log" + $dst = [System.IO.Path]::Combine($WorkingDirectory, "SplunkUniversalForwarder", "Get-NetTCPConnection.log") + Get-NetTCPConnection | Format-Table LocalAddress, LocalPort, RemoteAddress, RemotePort, State, OwningProcess | Out-File -FilePath $dst } #endregion log files @@ -174,15 +203,22 @@ Function New-uASupportBundle { Write-Verbose 'Collect uberAgent configuration files' -Verbose New-Item -Path "$WorkingDirectory" -Name Config -ItemType Directory | Out-Null - Copy-uAItem -Source "$env:programdata\vast limits\uberAgent\Configuration\*" -Destination "$WorkingDirectory\Config\ProgramData" -Recurse -Exclude $ExcludeExecutablesAndLibraries - Copy-uAItem -Source "$uberAgentInstallDir\*" -Destination "$WorkingDirectory\Config\ProgramFiles" -Recurse -Exclude $ExcludeExecutablesAndLibraries + $src = [System.IO.Path]::Combine($env:programdata, "vast limits\uberAgent\Configuration\*") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Config\ProgramData") + Copy-uAItem -Source $src -Destination $dst -Recurse -Exclude $ExcludeExecutablesAndLibraries + + $src = [System.IO.Path]::Combine($uberAgentInstallDir, "*") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Config\ProgramFiles") + Copy-uAItem -Source $src -Destination $dst -Recurse -Exclude $ExcludeExecutablesAndLibraries if ((Get-ItemProperty -Path "HKLM:\SOFTWARE\vast limits\uberAgent\Config" -Name ConfigFilePath -ErrorAction SilentlyContinue) -OR (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\vast limits\uberAgent\Config" -Name ConfigFilePath -ErrorAction SilentlyContinue)) { # CCFM is active $ConfigCachePath = (Get-ItemProperty -Path "HKLM:\SOFTWARE\vast limits\uberAgent\CCFM" -Name ConfigCachePath).ConfigCachePath if ($ConfigCachePath) { - Copy-uAItem -Source "$ConfigCachePath\*" -Destination "$WorkingDirectory\Config\CCFM" -Recurse -Exclude $ExcludeExecutablesAndLibraries + $src = [System.IO.Path]::Combine($ConfigCachePath, "*") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Config\CCFM") + Copy-uAItem -Source $src -Destination $dst -Recurse -Exclude $ExcludeExecutablesAndLibraries } else { Write-Warning "ConfigFilePath is set but ConfigCachePath is not. CCFM config is broken." @@ -192,8 +228,14 @@ Function New-uASupportBundle { If($SplunkUFinstalled) { Write-Verbose 'Collect Splunk Universal Forwarder configuration files' -Verbose - Copy-uAItem -Source "$SplunkUFInstallDir\etc\system\local\inputs.conf" -Destination "$WorkingDirectory\SplunkUniversalForwarder\inputs.conf" - Copy-uAItem -Source "$SplunkUFInstallDir\etc\system\local\outputs.conf" -Destination "$WorkingDirectory\SplunkUniversalForwarder\outputs.conf" + + $src = [System.IO.Path]::Combine($SplunkUFInstallDir, "etc\system\local\inputs.conf") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "SplunkUniversalForwarder", "inputs.conf") + Copy-uAItem -Source $src -Destination $dst + + $src = [System.IO.Path]::Combine($SplunkUFInstallDir, "etc\system\local\outputs.conf") + $dst = [System.IO.Path]::Combine($WorkingDirectory, "SplunkUniversalForwarder", "outputs.conf") + Copy-uAItem -Source $src -Destination $dst } #endregion config files @@ -209,7 +251,9 @@ Function New-uASupportBundle { Foreach ($RegKey in $RegKeys) { $RegKeyContent = Get-uARegistryItem -Key "$($RegKey.Path)" $RegKeyComponent = "$($RegKey.Component)" - Out-File -FilePath "$WorkingDirectory\Registry\$RegKeyComponent registry keys.txt" -InputObject $RegKeyContent -Append -NoClobber + + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Registry", "$RegKeyComponent registry keys.txt") + Out-File -FilePath $dst -InputObject $RegKeyContent -Append -NoClobber } #endregion registry @@ -218,8 +262,12 @@ Function New-uASupportBundle { New-Item -Path "$WorkingDirectory\Processes" -ItemType Directory | Out-Null Foreach ($Process in $Processes) { $ProcessDetail = Get-uAProcessDetails -ProcessName $Process + Write-Verbose "Collect details for process $Process" - Out-File -FilePath "$WorkingDirectory\Processes\Process details.txt" -InputObject $ProcessDetail -Append -NoClobber + + $dst = [System.IO.Path]::Combine($WorkingDirectory, "Processes", "Process details.txt") + + Out-File -FilePath $dst -InputObject $ProcessDetail -Append -NoClobber } #endregion processes @@ -227,6 +275,7 @@ Function New-uASupportBundle { Write-Verbose 'Create support zip file' -Verbose $CurrentDate = Get-Date -Format "yyyy-MM-dd HH-mm-ss" $ZipFilename = 'uASupportBundle-' + "$env:COMPUTERNAME" + '-' + "$CurrentDate" + '.zip' + Compress-uAArchive -SourceDir $WorkingDirectory -ZipFilename $ZipFilename -ZipFilepath $DesktopPath Write-Verbose "Successfully created uberAgent support bundle at $(Join-Path $DesktopPath $ZipFilename)" -Verbose #endregion zip file @@ -242,10 +291,18 @@ Function New-uASupportBundle { $stopWatch.Stop() Write-Verbose "Elapsed Runtime: $($stopWatch.Elapsed.Minutes) minutes and $($stopWatch.Elapsed.Seconds) seconds." -Verbose Stop-Transcript | Out-Null + # Delete old working folder if any If (Test-Path $WorkingDirectory) { - Remove-Item $WorkingDirectory -Force -Recurse -ErrorAction Stop - Write-Verbose "Successfully deleted working directory '$WorkingDirectory'" + + if ((Test-IsAbsolutePath -Path $WorkingDirectory) -eq $true) { + Remove-Item $WorkingDirectory -Force -Recurse -ErrorAction Stop + Write-Verbose "Successfully deleted working directory '$WorkingDirectory'" + } + else { + Write-Error "Failed to delete working directory '$WorkingDirectory'" + } + } } } @@ -253,8 +310,8 @@ Function New-uASupportBundle { # SIG # Begin signature block # MIIRVgYJKoZIhvcNAQcCoIIRRzCCEUMCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAgGVQ9KRRvWsve -# gRlDCozk49RpJjg+GRB2wkbp5RQCa6CCDW0wggZyMIIEWqADAgECAghkM1HTxzif +# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBzCMJu/A491jL+ +# Wf9iWiG4CMDeQEQzjzX+RgDvvXOIxqCCDW0wggZyMIIEWqADAgECAghkM1HTxzif # CDANBgkqhkiG9w0BAQsFADB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx # EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8G # A1UEAwwoU1NMLmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTAe @@ -331,17 +388,17 @@ Function New-uASupportBundle { # BAMMK1NTTC5jb20gQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBDQSBSU0EgUjEC # EH2BzCLRJ8FqayiMJpFZrFQwDQYJYIZIAWUDBAIBBQCggYQwGAYKKwYBBAGCNwIB # DDEKMAigAoAAoQKAADAZBgkqhkiG9w0BCQMxDAYKKwYBBAGCNwIBBDAcBgorBgEE -# AYI3AgELMQ4wDAYK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+# gnphN5gRx6ZYfeP8YHtmIfNvAx1XDF7ZVNwWiKAlGKXUYa8yCemBoE0ZLk1QCM9x +# tDrzLTSlHC/Gu0SmsQzwa/rWWgjJEcN+bb6ISFp2WL7VhqIuodeP7DOoSSr+7SKm +# bM1FY0Z+b4FO8EpE8kCb8zhYMAtdW6hwGdw67ihC+cj0+AYEwPR3WA9ZOiFqmSYh +# E3fzLGDS3/7jNC/fstHigzeSeMM98InW+fBwChJisJOCwR/68+VE9O+O3q0bTRAU +# iWJnAwB6clx2S5JBRYg7MHIJX8cL/g/l8GauN/vuKni7HPROMS1sOmr43OIFvr7W +# Z//Ziwz+0emJ2WRDl4JRGZcB6rO8JYYMEDmWaeNMo2jNmE/1+IBLV8nLxhXd3uEt +# y3GpTDsnCkJUXvjDFn/3VwCRNr26RYhkiC9zvki/JF15I/bOwggQ41FMOk0kn+c1 +# 8BRtdDBhab1Kyl0qAlkG1W3g1eIK3isp5ywYvKy2sQu/RjBgwX63X5tR4kEyVr9w +# AN1hZ/JyIVr67GbusuMAR2YlIVQzF4/4A2k= # SIG # End signature block diff --git a/uberAgentSupport/uberAgentSupport.psd1 b/uberAgentSupport/uberAgentSupport.psd1 index 25dbf12..213277b 100644 --- a/uberAgentSupport/uberAgentSupport.psd1 +++ b/uberAgentSupport/uberAgentSupport.psd1 @@ -12,7 +12,7 @@ RootModule = 'uberAgentSupport.psm1' # Version number of this module. - ModuleVersion = '1.3.1' + ModuleVersion = '1.3.2' # Supported PSEditions # CompatiblePSEditions = @() @@ -128,8 +128,8 @@ # SIG # Begin signature block # MIIRVgYJKoZIhvcNAQcCoIIRRzCCEUMCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCB8jjKh+f3k32nI -# oaiYpH9bHAm7AXrnUg9rrK709QGzX6CC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