Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 44 additions & 24 deletions uberAgentSupport-dev/Public/New-uASupportBundle.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,28 @@ Function New-uASupportBundle {
else {
Write-Verbose "LogPath found in 'HKLM:\SOFTWARE\Policies\vast limits\uberAgent\LogConfig'." -Verbose
}
if (-not $LogPath)
{
if (-not $LogPath) {
Write-Verbose "LogPath not found in 'HKLM:\SOFTWARE\vast limits\uberAgent\LogConfig'. Using default path." -Verbose
$LogPath = "$env:windir\temp"
}
else
{
else {
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

# Test access to log path
if (-not $(Test-Path -Path $ResolvedLogPath))
{
if (-not $(Test-Path -Path $ResolvedLogPath)) {
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 = [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 {
}
else {
Throw "Registry key 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' not found."
}
$uAInSessionHelperLog = [System.IO.Path]::Combine($ResolvedLogPath, "uAInSessionHelper.log")
Expand All @@ -63,11 +61,28 @@ Function New-uASupportBundle {
$OperatingSystem = (Get-CimInstance -Class Win32_OperatingSystem).caption
$DesktopPath = [Environment]::GetFolderPath('Desktop')
$OSBitness = $env:PROCESSOR_ARCHITECTURE
$Processes = @('uberAgent','uAInSessionHelper')
$UninstallPaths = @('HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*','HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*')
$uberAgentInstallDir = ($UninstallPaths | ForEach-Object {Get-ItemProperty $_} | Where-Object Displayname -match "uberAgent").InstallLocation
$Processes = @('uberAgent', 'uAInSessionHelper')
$UninstallPaths = @('HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*', 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*')

# Check if the given registry paths exist and filter out those that do not.
$UninstallPaths = $UninstallPaths | Where-Object { Test-Path $_ }

# Verify if there is at least one valid uninstall path.
if (-not $UninstallPaths) {
Write-Error "No valid uninstall path was found."
exit 1
}

$uberAgentInstallDir = ($UninstallPaths | ForEach-Object { Get-ItemProperty $_ } | Where-Object Displayname -match "uberAgent").InstallLocation

# Check if an uberAgent installation has been found.
if (-not $uberAgentInstallDir) {
Write-Error "No uberAgent installation found."
exit 1
}

$SplunkUFservice = "SplunkForwarder"
$ExcludeExecutablesAndLibraries = @('*.exe','*.dll','*.sys','*.msi')
$ExcludeExecutablesAndLibraries = @('*.exe', '*.dll', '*.sys', '*.msi')

$RegKeysx86 = @(
[PSCustomObject]@{Component = 'Service'; Path = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\vast limits' }
Expand Down Expand Up @@ -98,12 +113,12 @@ Function New-uASupportBundle {
If ($OSBitness -eq 'AMD64') { $RegKeys = $RegKeysx64 } Else { $RegKeys = $RegKeysx86 }

If ((Get-Service).Name -contains $SplunkUFservice) {
$SplunkUFinstalled = $True
$SplunkUFInstallDir = (($UninstallPaths | ForEach-Object {Get-ItemProperty $_} | Where-Object Displayname -match "UniversalForwarder").InstallLocation).TrimEnd("\")
$Processes += 'splunkd'
$SplunkUFinstalled = $True
$SplunkUFInstallDir = (($UninstallPaths | ForEach-Object { Get-ItemProperty $_ } | Where-Object Displayname -match "UniversalForwarder").InstallLocation).TrimEnd("\")
$Processes += 'splunkd'
}
Else {
$SplunkUFinstalled = $False
$SplunkUFinstalled = $False
}

# Check for latest module version
Expand Down Expand Up @@ -150,15 +165,21 @@ 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) {
$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 Config and Support Tool log' -Verbose
foreach ($UserProfile in $UserProfiles) {
$src = [System.IO.Path]::Combine($ProfilesDirectory, $UserProfile, "AppData\Local\Temp\uAConfigSupportTool.log")
$dst = [System.IO.Path]::Combine($WorkingDirectory, "uAConfigSupportTool", "uAConfigSupportTool-$UserProfile.log")

Copy-uAItem -Source $src -Destination $dst
}

Write-Verbose 'Collect Internet Explorer add-on log' -Verbose
foreach ($UserProfile in $UserProfiles) {
$src = [System.IO.Path]::Combine($ProfilesDirectory, $UserProfile, "AppData\Local\Temp\Low\uberAgentIEExtension.log")
Expand All @@ -182,7 +203,7 @@ Function New-uASupportBundle {
}
}

If($SplunkUFinstalled) {
If ($SplunkUFinstalled) {
Write-Verbose 'Collect Splunk Universal Forwarder logs' -Verbose

$src = [System.IO.Path]::Combine($SplunkUFInstallDir, "var\log\splunk\splunkd.log")
Expand All @@ -206,16 +227,15 @@ Function New-uASupportBundle {
$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)
{
if ($ConfigCachePath) {
$src = [System.IO.Path]::Combine($ConfigCachePath, "*")
$dst = [System.IO.Path]::Combine($WorkingDirectory, "Config\CCFM")
Copy-uAItem -Source $src -Destination $dst -Recurse -Exclude $ExcludeExecutablesAndLibraries
Expand All @@ -226,7 +246,7 @@ Function New-uASupportBundle {

}

If($SplunkUFinstalled) {
If ($SplunkUFinstalled) {
Write-Verbose 'Collect Splunk Universal Forwarder configuration files' -Verbose

$src = [System.IO.Path]::Combine($SplunkUFInstallDir, "etc\system\local\inputs.conf")
Expand Down Expand Up @@ -302,7 +322,7 @@ Function New-uASupportBundle {
else {
Write-Error "Failed to delete working directory '$WorkingDirectory'"
}

}
}
}
Expand Down
2 changes: 1 addition & 1 deletion uberAgentSupport-dev/uberAgentSupport.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'uberAgentSupport.psm1'

# Version number of this module.
ModuleVersion = '1.3.2'
ModuleVersion = '1.3.3'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
98 changes: 59 additions & 39 deletions uberAgentSupport/Public/New-uASupportBundle.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,28 @@ Function New-uASupportBundle {
else {
Write-Verbose "LogPath found in 'HKLM:\SOFTWARE\Policies\vast limits\uberAgent\LogConfig'." -Verbose
}
if (-not $LogPath)
{
if (-not $LogPath) {
Write-Verbose "LogPath not found in 'HKLM:\SOFTWARE\vast limits\uberAgent\LogConfig'. Using default path." -Verbose
$LogPath = "$env:windir\temp"
}
else
{
else {
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

# Test access to log path
if (-not $(Test-Path -Path $ResolvedLogPath))
{
if (-not $(Test-Path -Path $ResolvedLogPath)) {
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 = [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 {
}
else {
Throw "Registry key 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' not found."
}
$uAInSessionHelperLog = [System.IO.Path]::Combine($ResolvedLogPath, "uAInSessionHelper.log")
Expand All @@ -63,11 +61,28 @@ Function New-uASupportBundle {
$OperatingSystem = (Get-CimInstance -Class Win32_OperatingSystem).caption
$DesktopPath = [Environment]::GetFolderPath('Desktop')
$OSBitness = $env:PROCESSOR_ARCHITECTURE
$Processes = @('uberAgent','uAInSessionHelper')
$UninstallPaths = @('HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*','HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*')
$uberAgentInstallDir = ($UninstallPaths | ForEach-Object {Get-ItemProperty $_} | Where-Object Displayname -match "uberAgent").InstallLocation
$Processes = @('uberAgent', 'uAInSessionHelper')
$UninstallPaths = @('HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*', 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*')

# Check if the given registry paths exist and filter out those that do not.
$UninstallPaths = $UninstallPaths | Where-Object { Test-Path $_ }

# Verify if there is at least one valid uninstall path.
if (-not $UninstallPaths) {
Write-Error "No valid uninstall path was found."
exit 1
}

$uberAgentInstallDir = ($UninstallPaths | ForEach-Object { Get-ItemProperty $_ } | Where-Object Displayname -match "uberAgent").InstallLocation

# Check if an uberAgent installation has been found.
if (-not $uberAgentInstallDir) {
Write-Error "No uberAgent installation found."
exit 1
}

$SplunkUFservice = "SplunkForwarder"
$ExcludeExecutablesAndLibraries = @('*.exe','*.dll','*.sys','*.msi')
$ExcludeExecutablesAndLibraries = @('*.exe', '*.dll', '*.sys', '*.msi')

$RegKeysx86 = @(
[PSCustomObject]@{Component = 'Service'; Path = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\vast limits' }
Expand Down Expand Up @@ -98,12 +113,12 @@ Function New-uASupportBundle {
If ($OSBitness -eq 'AMD64') { $RegKeys = $RegKeysx64 } Else { $RegKeys = $RegKeysx86 }

If ((Get-Service).Name -contains $SplunkUFservice) {
$SplunkUFinstalled = $True
$SplunkUFInstallDir = (($UninstallPaths | ForEach-Object {Get-ItemProperty $_} | Where-Object Displayname -match "UniversalForwarder").InstallLocation).TrimEnd("\")
$Processes += 'splunkd'
$SplunkUFinstalled = $True
$SplunkUFInstallDir = (($UninstallPaths | ForEach-Object { Get-ItemProperty $_ } | Where-Object Displayname -match "UniversalForwarder").InstallLocation).TrimEnd("\")
$Processes += 'splunkd'
}
Else {
$SplunkUFinstalled = $False
$SplunkUFinstalled = $False
}

# Check for latest module version
Expand Down Expand Up @@ -150,15 +165,21 @@ 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) {
$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 Config and Support Tool log' -Verbose
foreach ($UserProfile in $UserProfiles) {
$src = [System.IO.Path]::Combine($ProfilesDirectory, $UserProfile, "AppData\Local\Temp\uAConfigSupportTool.log")
$dst = [System.IO.Path]::Combine($WorkingDirectory, "uAConfigSupportTool", "uAConfigSupportTool-$UserProfile.log")

Copy-uAItem -Source $src -Destination $dst
}

Write-Verbose 'Collect Internet Explorer add-on log' -Verbose
foreach ($UserProfile in $UserProfiles) {
$src = [System.IO.Path]::Combine($ProfilesDirectory, $UserProfile, "AppData\Local\Temp\Low\uberAgentIEExtension.log")
Expand All @@ -182,7 +203,7 @@ Function New-uASupportBundle {
}
}

If($SplunkUFinstalled) {
If ($SplunkUFinstalled) {
Write-Verbose 'Collect Splunk Universal Forwarder logs' -Verbose

$src = [System.IO.Path]::Combine($SplunkUFInstallDir, "var\log\splunk\splunkd.log")
Expand All @@ -206,16 +227,15 @@ Function New-uASupportBundle {
$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)
{
if ($ConfigCachePath) {
$src = [System.IO.Path]::Combine($ConfigCachePath, "*")
$dst = [System.IO.Path]::Combine($WorkingDirectory, "Config\CCFM")
Copy-uAItem -Source $src -Destination $dst -Recurse -Exclude $ExcludeExecutablesAndLibraries
Expand All @@ -226,7 +246,7 @@ Function New-uASupportBundle {

}

If($SplunkUFinstalled) {
If ($SplunkUFinstalled) {
Write-Verbose 'Collect Splunk Universal Forwarder configuration files' -Verbose

$src = [System.IO.Path]::Combine($SplunkUFInstallDir, "etc\system\local\inputs.conf")
Expand Down Expand Up @@ -302,16 +322,16 @@ Function New-uASupportBundle {
else {
Write-Error "Failed to delete working directory '$WorkingDirectory'"
}

}
}
}
}
# SIG # Begin signature block
# MIIRVgYJKoZIhvcNAQcCoIIRRzCCEUMCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBzCMJu/A491jL+
# Wf9iWiG4CMDeQEQzjzX+RgDvvXOIxqCCDW0wggZyMIIEWqADAgECAghkM1HTxzif
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCCeYQ77E5qbl8K9
# 3rffeWu76MMwcek0UmvnBP/fYimEn6CCDW0wggZyMIIEWqADAgECAghkM1HTxzif
# CDANBgkqhkiG9w0BAQsFADB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
# EDAOBgNVBAcM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