You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functionGet-DBCServiceInformation {
$DisplayName="Incontact"# Check if running PowerShell 5 or earlierif ($PSVersionTable.PSVersion.Major-le5) {
# Get all services that match the display name using Get-WmiObject$services=Get-WmiObject-Class Win32_Service |Where-Object {$_.DisplayName-like"*$DisplayName*"}
} else {
# Get all services that match the display name using Get-CimInstance$services=Get-CimInstance-ClassName Win32_Service |Where-Object {$_.DisplayName-like"*$DisplayName*"}
}
# Display the results$services|Select-Object-Property Name, DisplayName, PathName, Status
}
# Usage:Get-DBCServiceInformation
Connection Information
functionGet-DBCConnections {
# Define the process name to track$trackProcessName="*DBCServer*"# Get established connections for the specified process$establishedConnections=Get-NetTCPConnection|Where-Object {$_.OwningProcess-gt0} |Select-Object-Property LocalAddress, LocalPort, RemoteAddress, RemotePort, State,@{name='ProcessName';expression={(Get-Process-Id $_.OwningProcess).Path}}, CreationTime
# Filter connections by process name$connectionsToTrack=$establishedConnections|Where-Object {$_.ProcessName-like$trackProcessName}
# Return the filtered connections$connectionsToTrack
}
# Usage:Get-DBCConnections|Format-Table
functionCopy-LogsToDesktop {
param (
[string]$SourceFolderPath="C:\Program Files (x86)\inContact\DBConnector"
)
# Define the desktop path$desktopPath= [Environment]::GetFolderPath("Desktop")
# Get the timestamp$timestamp=Get-Date-Format "yyyyMMdd_HHmmss"# Create the log folder name$logFolderName="DBConnectorLogs_$env:COMPUTERNAME_$timestamp"# Create the full log folder path$logFolderPath=Join-Path-Path $desktopPath-ChildPath $logFolderName# Create the log folderNew-Item-Path $logFolderPath-ItemType Directory -Force
# Copy log files to the log folderGet-ChildItem-Path $SourceFolderPath-Filter *.log -Recurse |Copy-Item-Destination $logFolderPath# Zip the log folderCompress-Archive-Path $logFolderPath-DestinationPath (Join-Path-Path $desktopPath-ChildPath ($logFolderName+".zip"))
Write-Host"Logs have been copied and zipped to the desktop."
}
# Usage:Copy-LogsToDesktop