Posts

VEEAM GUI - single Tape Job sessions.1.0

cls Write-Host "VEEAM GUI - single Tape Job sessions.1.0" -BackgroundColor DarkRed -ForegroundColor Yellow Write-Host "Wait...Wait...Wait..." # Importing necessary .NET Assembly Add-Type -AssemblyName System.Windows.Forms [System.Windows.Forms.Application]::EnableVisualStyles() # Main Form $MainForm = New-Object System.Windows.Forms.Form $MainForm.Text = 'Veeam Tape Backup Job' $MainForm.Size = New-Object System.Drawing.Size(350, 400) $MainForm.StartPosition = 'CenterScreen' $MainForm.TopMost = $true # Prepare for CSV Export $OutputPath = 'C:\Veeam-Tape-Logs' if (!(Test-Path -Path $OutputPath -PathType Container)) { $null = New-Item -ItemType Directory -Path $OutputPath } # Fetch all tape jobs upfront $TapeJobs = Get-VBRTapeJob # GUI elements # Jobs ListBox $ListBoxJobs = New-Object System.Windows.Forms.ListBox $ListBoxJobs.Location = New-Object System.Drawing.Point(10, 10) $ListBoxJobs.Size = New-...

VEEAM GUI - single Job sessions.1.0

cls Write-Host "VEEAM GUI - single Job sessions.1.0" -BackgroundColor DarkRed -ForegroundColor Yellow Write-Host "Wait...Wait...Wait..." # Importing necessary .NET Assembly Add-Type -AssemblyName System.Windows.Forms [System.Windows.Forms.Application]::EnableVisualStyles() # Main Form $MainForm = New-Object System.Windows.Forms.Form $MainForm.Text = 'Veeam Tape Job' $MainForm.Size = New-Object System.Drawing.Size(350, 400) $MainForm.StartPosition = 'CenterScreen' $MainForm.TopMost = $true # Prepare for CSV Export $OutputPath = 'C:\Veeam-Logs' if (!(Test-Path -Path $OutputPath -PathType Container)) { $null = New-Item -ItemType Directory -Path $OutputPath } # Fetch all backup sessions upfront $BackupSessions = Get-VBRBackupSession # GUI elements # Jobs ListBox $ListBoxJobs = New-Object System.Windows.Forms.ListBox $ListBoxJobs.Location = New-Object System.Drawing.Point(10, 10) $ListBoxJobs.Size = New-Object System.Drawing.Size(300, ...

VEEAM - Export Job Sessions (logs) by Keyword

cls Write-Host "VEEAM - Export Job Sessions by Keyword" -BackgroundColor DarkRed -ForegroundColor Yellow Write-Host "Wait...Wait...Wait..." Write-Host # Define the keyword that is common to all the jobs, date and path to file $Keyword = "DB" $date = (Get-Date).ToString('yyyy-MM-dd') $folderPath = "C:\Backup\" # Get the date for desired days ago $OneYearAgo = (Get-Date).AddYears(-1) # Get all jobs that contain the keyword in their name $Jobs = Get-VBRJob | Where-Object {$_.Name -like "*$Keyword*"} # Get all sessions $AllBackupSessions = Get-VBRBackupSession # The longest part of the script Write-Host "I'm going to export all jobs with keyword $Keyword" -ForegroundColor Green foreach ($Job in $Jobs) { $BackupSessions = "" $filePath = "" $JobName = $Job.name Write-Host Write-Host "JobName: $JobName" # Get all sessions for the specified job from the past ...

vCloud Template Export To OVF

Image
#ScriptDescription : =Export from Template to OVF= cls Write-Host "Export from vCloud Template to OVF with help of vCenter" -BackgroundColor DarkRed -foreground Yellow Write-Host "(Check lease and renew if needed)" -BackgroundColor Black $TemplateName = "" $DestVAppName = "" $SubStringLength = "10" Import-Module VMware.PowerCLI | Out-Null # Import-Module VMware.PowerCLI 3>$null Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -confirm:$false | Out-Null $ErrorActionPreference = 'SilentlyContinue' $WarningActionPreference = 'SilentlyContinue' $ErrorPreference = 'SilentlyContinue' $WarningPreference = 'SilentlyContinue' ##== Defining general parameters ==## [Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') > $NULL $TemplateName = [Microsoft.VisualBasic.Interaction]::InputBox("Put Template name `n(otherwise the script will exit...)", "Template Name...

Dynamic menu script to run other scripts

# Get scripts in a folder, create a GUI menu and run the chosen script # "Path_To_Scripts_Directory\" - it's not where this launching script is located, it's where the bunch of scripts you want to create the menu from is. $PathToScripts = "Path_To_Scripts_Directory\" $FilesInPath = $PathToScripts+"*" # get a list of scripts/files $Scripts = Get-ChildItem -File $FilesInPath | sort Name # choosing the script for run $SelectedScript = $Scripts.Name | OGV -Title "Menu" -PassThru $FullPathToScript = $PathToScripts+$SelectedScript # launching selected script & $FullPathToScript

PowerCLI Amateur declaration

This blog aims to be a helping hand for folks who aren't programmers. Personally, I'm not a coder or developer - I work in IT.  IT professionals in big companies often need to automate some tasks but might not know how. There's a lot of information on the internet, but much of it is geared towards those who already know programming. Many scripts use programming techniques that non-programmers don't get. On my journey with PowerShell/PowerCLI, I've learned that even complex scripts can spark ideas, and you can use them in a simpler way. I want to show you how to do this easily and without over-complicating things. But I also don't want to make things too simple. Folks often use too many pipes in their scripts. I get why - a pipe lets you put a whole script on one line, which seems easy, and you can copy/paste it into the PowerShell command line.  This works well for short and simple tasks, but not for longer and more complicated ones. That's when the simple t...