This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Checking elevation rights | |
| if (!(New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) | |
| { | |
| Write-Host "You're running PowerShell without elevated rights. Please re-run this script using PowerShell as an Administrator." -BackgroundColor Black -ForegroundColor Red | |
| $null = Read-Host 'Press [ENTER] to exit.' | |
| Exit | |
| } | |
| #Get current user for logging purposes | |
| Import-Module Veeam.Backup.PowerShell -ErrorAction SilentlyContinue -WarningAction SilentlyContinue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Verify running PowerShell as Administrator | |
| Write-Console "Checking elevation rights..." "White" 1 | |
| if (!(New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { | |
| Write-Console "PowerShell does not have elevated rights. Please open a PowerShell window as Administrator and run the script again." "Red" 3 | |
| Exit | |
| } | |
| else { | |
| Write-Console "PowerShell is running with Administrator privileges. Starting data collection..." | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Write-Host " | |
| List of valid Azure regions: | |
| uswestcentral | |
| uswest2 | |
| uswest | |
| ussouth | |
| usnorth | |
| useast2euap | |
| useast2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Get-VeeamNetStats | |
| { | |
| $properties = 'Protocol','LocalAddress','LocalPort' | |
| $properties += 'RemoteAddress','RemotePort','State','ProcessName','PID' | |
| netstat -ano | Select-String -Pattern '\s+(TCP|UDP)' | % { | |
| $item = $_.line.split( " ",[System.StringSplitOptions]::RemoveEmptyEntries ) | |
| if ( $item[1] -notmatch '^\[::' ) |