r/PowerShell • • 22h ago

News Advent of PowerShell

42 Upvotes

Looking for a fun way to sharpen your PowerShell skills this December?

Advent of PowerShell is live!

🎄 24 daily PowerShell coding challenges

Whether you're just getting started with PowerShell or have been automating everything in sight for years, it's a great excuse to write some PowerShell, challenge yourself and explore different approaches to solving problems.

Get started here: https://2026.powershell.au/

Would love to see how everyone approaches the challenges. Feel free to share your experiences, feedback and creative solutions (with spoiler tags, of course!).

Disclosure: AI did help me create the website and text above. I can only include 1 tag, and I felt News was more appropriate


r/PowerShell • • 17h ago

News PS7 ScriptDesk (Custom PS7 ISE) — Development Update

5 Upvotes

I had ChatGPT help write the update. -Ron

Thank you to everyone who has been testing PS7 ScriptDesk, reporting issues, suggesting improvements, and providing valuable feedback. Your participation continues to help shape the application into a more capable, reliable, and user-friendly PowerShell 7 development environment.

What's New

Expanded PowerShell Code Snippets

The code snippet system has been significantly enhanced to incorporate Microsoft's official PowerShell snippet library.

  • 51 Microsoft PowerShell snippets and 21 ScriptDesk snippets, providing 72 built-in code templates.
  • Microsoft-first snippet integration with IntelliSense.
  • A new Insert Snippet option in the editor's right-click context menu.
  • Ctrl+J opens a searchable snippet library.
  • Search by snippet name, keyword, description, or category.
  • Filter snippets by category and source.
  • Preview PowerShell code before inserting it into your script.
  • Interactive, linked placeholders with keyboard navigation for rapid code customization.
  • Full integration with the existing ScriptDesk editor and theme system.

These enhancements make writing PowerShell scripts faster and easier while reducing repetitive coding.

Native PowerShell Command Builder

PS7 ScriptDesk now provides direct access to PowerShell's built-in graphical Command Builder through the Tools → Command Builder menu.

Two operating modes are available:

  • Interactive: Launches the Command Builder within your existing PowerShell session.
  • Distinct: Launches the Command Builder independently, allowing you to continue working in ScriptDesk.

The Command Builder allows users to explore available PowerShell commands, view their parameters, configure arguments, and construct properly formatted PowerShell commands through a graphical interface.

Rather than developing a proprietary replacement, ScriptDesk leverages Microsoft's native PowerShell functionality.

Continued Quality and Performance Improvements

Development continues to focus on:

  • Application stability and reliability.
  • Improved editor responsiveness.
  • Consistent and intuitive user interfaces.
  • Compatibility with established PowerShell development workflows.
  • Reuse of proven native technologies.
  • Maintaining a streamlined application without unnecessary software bloat.

What's Coming Next

The next planned enhancement is a comprehensive Snippet Manager and Creator, which will allow users to:

  • Create and maintain their own reusable PowerShell snippets.
  • Create snippets directly from selected editor code.
  • Customize existing snippets.
  • Organize snippets into categories, subcategories, and favorites.
  • Assign custom IntelliSense expansion keywords.
  • Import and export snippets compatible with Visual Studio Code and Windows PowerShell ISE.

Your Feedback Matters

Whether you are a PowerShell beginner, an experienced developer, a system administrator, or a longtime Windows PowerShell ISE user, your feedback is welcome.

Please continue to report bugs, request features, and share suggestions through the PS7 ScriptDesk GitHub repository:

https://github.com/RonB56/PS7-ScriptDesk

The goal remains to provide a modern, powerful, intuitive, and free integrated scripting environment designed specifically for PowerShell 7.

Thank you for your continued support and for being part of the PS7 ScriptDesk community!


r/PowerShell • • 4h ago

Misc Converted my PS Script to PS7

2 Upvotes

I know there are plenty of AI haters out there but I wanted to get ahead of the switch from PS 5.1 to PS 7 but it's been too long since I did any PS coding and I didn't feel the urge to get back up to speed. So, as an alternative, I fed my script that's contains code for a GUI input form into Gemini AI and within seconds it converted my script to PS7. Needless to say I was impressed that Gemini AI could convert PS scripts.


r/PowerShell • • 1h ago

Script Sharing PowerBGInfo - BGInfo alternative with support for Windows, Linux and macOS

0 Upvotes

PowerBGInfo now has a website https://powerbginfo.com with demos, examples, use cases etc. I've also added preview support for macOS, Linux, but that needs larger testing so please report any issues in that area.

The website contains proper examples and how you can make them your own including white labeling and whatever else you want to keep on your desktops/servers. All with support out of the box.

Sources: https://github.com/EvotecIT/PowerBGInfo

I am using AI on daily basis.

Here's an example (one of many) - all of them are available on the website.

<#
    Hyper-V host. The question for the administrator at this console: does
    this host have room for another VM, and which VMs are using it?

    The data block returns plain values; the presentation block only reads
    them. Comments name the command or source that supplies each value.
#>
param(
    [ValidateSet('Light', 'Dark')]
    [string] $Theme = 'Dark',
    [int] $Width = 1920,
    [int] $Height = 1080,
    [string] $OutputDirectory = (Join-Path $PSScriptRoot 'Output')
)

if (-not (Get-Module -Name PowerBGInfo)) {
    Import-Module PowerBGInfo -ErrorAction Stop
}

#region Data: your logic goes here
function Get-HyperVHostData {
    # Get-VM returns these properties (MemoryAssigned, ProcessorCount and
    # CPUUsage); the workload tag comes from the VM notes or your CMDB.
    # The sample keeps them as CSV to stay short.
    $vms = @'
Name,Workload,vCPU,MemoryGB,Cpu
SQL-PROD-01,Databases,16,128,71
SQL-PROD-02,Databases,16,96,34
SQL-RPT-01,Databases,8,48,12
ERP-APP-01,ERP,12,64,38
ERP-APP-02,ERP,12,64,29
ERP-BATCH-01,ERP,8,32,55
VDI-POOL-A,Desktops,48,96,41
VDI-POOL-B,Desktops,24,48,18
WEB-01,Web,4,16,22
WEB-02,Web,4,16,19
WEB-03,Web,4,16,9
FS-01,Infrastructure,4,32,6
MON-01,Infrastructure,4,24,14
DC02,Infrastructure,2,8,3
'@ | ConvertFrom-Csv | ForEach-Object {
        [pscustomobject] @{
            Name = $_.Name; Workload = $_.Workload; vCPU = [int] $_.vCPU
            MemoryGB = [int] $_.MemoryGB; Cpu = [int] $_.Cpu; State = 'Running'
        }
    }

    [pscustomobject] @{
        Available = $true
        Name     = 'HV-AMS-07'
        # Get-Cluster and Get-ClusterNode
        Cluster  = 'HVC-AMS-01 · node 3 of 6'
        Hardware = '2 × Xeon Gold 6448Y · 64 cores'
        Version  = 'Windows Server 2025 Datacenter'
        # Get-Counter '\Hyper-V Hypervisor Logical Processor(_Total)\
        #     % Total Run Time' sampled every 5 minutes
        Cpu      = @(38, 41, 52, 47, 44, 49, 46)
        # (Get-VMHost).MemoryCapacity and the sum of MemoryAssigned
        MemoryGB = [int] ($vms | Measure-Object -Property MemoryGB -Sum).Sum
        # The cluster keeps one node's worth of memory free for failover.
        ReserveGB = 64
        TotalGB  = 768
        # Get-ClusterSharedVolume | Select-Object -ExpandProperty
        #     SharedVolumeInfo | Select-Object -ExpandProperty Partition
        Storage  = @{ Name = 'CSV-02'; UsedPercent = 68; FreeTB = 6.1 }
        Vms      = $vms
        # Get-ClusterGroup | Where-Object OwnerNode -NE $env:COMPUTERNAME,
        # or the Failover Clustering event log, event 5143 and 1641
        Moves    = @(
            [pscustomobject] @{ Time = '09:12'; VM = 'ERP-BATCH-01'
                Move = 'from HV-AMS-04'; Result = 'OK' }
            [pscustomobject] @{ Time = '08:47'; VM = 'WEB-03'
                Move = 'from HV-AMS-02'; Result = 'OK' }
            [pscustomobject] @{ Time = '02:05'; VM = 'VDI-POOL-B'
                Move = 'to HV-AMS-05'; Result = 'Failed' }
        )
        # Memory assigned on every node: Get-ClusterNode | ForEach-Object {
        #     Get-VM -ComputerName $_.Name | Measure-Object MemoryAssigned }
        Nodes       = [ordered] @{
            'HV-AMS-04' = 71; 'HV-AMS-05' = 64; 'HV-AMS-07' = 82
            'HV-AMS-08' = 91; 'HV-AMS-09' = 58; 'HV-AMS-10' = 47
        }
        # Get-VM | Get-VMSnapshot | Where-Object CreationTime -LT
        #     (Get-Date).AddDays(-7)
        Checkpoints = @(
            @{ Text = 'ERP-APP-02 · before CU 14'; Status = 'Warning'
                Value = '12 days' }
            @{ Text = 'WEB-02 · config test'; Status = 'Warning'
                Value = '9 days' }
        )
    }
}

$fallback = [pscustomobject] @{
    Available = $false
    Name = $env:COMPUTERNAME; Cluster = 'unknown'; Hardware = 'unknown'
    Version = 'unknown'; Cpu = @(0); MemoryGB = 0; TotalGB = 1; ReserveGB = 0
    Storage = @{ Name = 'CSV'; UsedPercent = 0; FreeTB = 0 }
    Vms = @([pscustomobject] @{ Name = 'unknown'; Workload = ''
            vCPU = 0; MemoryGB = 1; Cpu = 0; State = 'Unknown' })
    Moves = @(); Checkpoints = @(); Nodes = [ordered] @{ 'unknown' = 0 }
}
$source = @{
    Name           = 'Hyper-V host'
    TimeoutSeconds = 20
    ScriptBlock    = ${function:Get-HyperVHostData}
    Default        = $fallback
}
$hv = Invoke-BGInfoDataSource 
#endregion

#region Presentation: reads only $hv
$scale = [Math]::Round($Height / 1080, 2)
$look = New-BGInfoTheme Corporate -Mode $Theme -Scale $scale
$memory = [Math]::Round(100 * $hv.MemoryGB / $hv.TotalGB)
$running = @($hv.Vms | Where-Object State -EQ 'Running').Count
$vcpu = ($hv.Vms | Measure-Object vCPU -Sum).Sum
$free = $hv.TotalGB - $hv.MemoryGB - $hv.ReserveGB

New-BGInfo -Theme $look -Target File {
    New-BGInfoBackground -Width $Width -Height $Height -Pattern Grid `
        -PatternSpacing ([int](56 * $scale))
    # A wider right column for the tables; the treemap may fill the center.
    New-BGInfoLayout -ColumnWidth ([int](520 * $scale)) `
        -MaximumPanelHeight ([int](640 * $scale))

    New-BGInfoLabel -Name 'HYPER-V HOST  ·  PRODUCTION CLUSTER' -Accent `
        -FontSize ([int](15 * $scale)) -FontWeight 700
    New-BGInfoLabel -Name $hv.Name -FontSize ([int](72 * $scale)) `
        -FontWeight 600
    $capacity = if ($hv.Available) {
        "Room for $free GB of VMs before failover reserve"
    } else { 'Host capacity unavailable' }
    New-BGInfoLabel -Name $capacity `
        -FontSize ([int](19 * $scale)) -FontWeight 600
    New-BGInfoValue -Name 'Cluster' -Value $hv.Cluster
    New-BGInfoValue -Name 'Hardware' -Value $hv.Hardware
    New-BGInfoValue -Name 'System' -Value $hv.Version

    # Top band: four host metrics beside the text. Above 80 % memory or
    # 75 % storage the card turns amber; above 90 % it turns red.
    if ($hv.Available) {
        $card = @{ Region = 'Top'; Height = [int](170 * $scale) }
        New-BGInfoMetric  -Label 'CPU' -Value $hv.Cpu[-1] -Unit '%' `
            -Caption '64 logical cores' -History $hv.Cpu -HistoryMaximum 100 `
            -WarningThreshold 70 -CriticalThreshold 85
        New-BGInfoMetric  -Label 'Memory' -Value $memory -Unit '%' `
            -Caption "$($hv.MemoryGB) of $($hv.TotalGB) GB assigned" `
            -WarningThreshold 80 -CriticalThreshold 90
        New-BGInfoMetric  -Label $hv.Storage.Name -Unit '%' `
            -Value $hv.Storage.UsedPercent `
            -Caption "$($hv.Storage.FreeTB) TB free" `
            -WarningThreshold 75 -CriticalThreshold 90
        New-BGInfoMetric u/card -Label 'VMs running' -Value $running `
            -Caption "$vcpu vCPU on 64 cores"

        # Center: where the memory goes, grouped by workload. The color is the
        # VM's CPU: amber from 60 %, red from 85 %.
        $hv.Vms | New-BGInfoTreemap -Region Center -Title 'Memory by VM' `
            -Note 'size: memory · color: CPU' -ValueProperty MemoryGB `
            -GroupProperty Workload -ValueSuffix ' GB' -ColorProperty Cpu `
            -WarningThreshold 60 -CriticalThreshold 85

        # Right column: cluster memory by node, today's live migrations and the
        # checkpoints left behind. Each node keeps its label and palette color.
        New-BGInfoChart -Region Right -Id 'nodes' -Title 'Cluster memory' `
            -Kind HorizontalBar -Values @($hv.Nodes.Values) `
            -Labels @($hv.Nodes.Keys) `
            -Palette @($look.Accent, $look.SecondaryAccent, $look.Ok, `
                $look.Warning, $look.Critical, $look.Info) `
            -Maximum 100 -ValueSuffix ' %' -NoHistory `
            -Height ([int](250 * $scale))
        $hv.Moves | New-BGInfoTable -Region Right -Title 'Live migrations' `
            -Note 'today' -Property Time, VM, Result -StatusColumn Result
        New-BGInfoList -Region Right -Title 'Old checkpoints' `
            -Note 'older than 7 days' -Item $hv.Checkpoints
    }
} -ConfigurationDirectory $OutputDirectory `
    -OutputFileName "hyperv-host-$($Theme.ToLower()).png"
#endregion
Lines 120 to 180 on GitHub

Help desk
How to get help, plus the details support asks for.

Orchid theme preset
Generated gradient background with glows and dots
Visual canvas info tiles with built-in icons
Shared text styles for headings, values and status
helpdesk-dark.png
PNG 1920 x 1080, 292 KB
Script on GitHub
Help desk wallpaper: how to reach the service desk, its portal, hours and current service status, with tiles for asset tag, computer name, IP address, signed-in user and Windows version. Dark theme.

Presentation

Data
PowerShell
Run.BGInfo.HelpDesk.ps1

Copy
New-BGInfo -Theme $look -TextPosition MiddleLeft -Target File {
    New-BGInfoBackground -Width $Width -Height $Height
    # The tile column sits vertically centered beside the centered text.
    New-BGInfoLayout -ColumnAlignment Center

    New-BGInfoLabel -Name 'IT SERVICE DESK' -Accent `
        -FontSize ([int](16 * $scale)) -FontWeight 700
    New-BGInfoLabel -Name 'Need help?' -FontSize ([int](88 * $scale)) `
        -FontWeight 600
    New-BGInfoLabel -Name 'Call 555-0100, extension 4357' -Accent `
        -FontSize ([int](40 * $scale)) -FontWeight 600
    New-BGInfoLabel -Name 'Have the asset tag on the right ready.' -Muted `
        -FontSize ([int](22 * $scale))
    New-BGInfoValue -Name 'Portal' -Value 'help.contoso.com'
    New-BGInfoValue -Name 'Teams' -Value '#it-help'
    New-BGInfoValue -Name 'Walk-in' -Value 'Building B, room 012'
    New-BGInfoValue -Name 'Hours' -Value 'Monday–Friday, 07:00–19:00'

    New-BGInfoLabel -Name ' ' -FontSize ([int](12 * $scale))
    New-BGInfoLabel -Name 'SERVICE STATUS' -Accent `
        -FontSize ([int](16 * $scale)) -FontWeight 700
    foreach ($service in $facts.Services) {
        New-BGInfoLabel -Name "●  $($service.Text)" -Status $service.Status `
            -FontSize ([int](19 * $scale)) -FontWeight 600
    }

    New-BGInfoVisualCanvas -Region Right -Tile $tiles
} -ConfigurationDirectory $OutputDirectory `
    -OutputFileName "helpdesk-$($Theme.ToLower()).png"
#endregion
Full script
109 lines
Lines 80 to 109 on GitHub

Meeting room
Which room, is it free, and how to share a screen.

Orchid theme preset
Single-day Gantt lanes for this room and the rooms next door
Wi-Fi QR code
Numbered list
meeting-room-dark.png
PNG 1920 x 1080, 243 KB
Script on GitHub
Meeting room wallpaper for Oslo: free until 13:00, the next booking, a guest Wi-Fi QR code, numbered steps to share a screen and today's bookings beside the neighbouring rooms. Dark theme.

Presentation

Data
PowerShell
Run.BGInfo.MeetingRoom.ps1

Copy
New-BGInfo -Theme $look -Target File {
    New-BGInfoBackground -Width $Width -Height $Height -Pattern None

    New-BGInfoLabel -Name $room.Where -Accent -FontSize ([int](15 * $scale)) `
        -FontWeight 700
    New-BGInfoLabel -Name $room.Room -FontSize ([int](150 * $scale)) `
        -FontWeight 700
    New-BGInfoLabel -Name "●  $($status.Text)" -Status $status.Status `
        -FontSize ([int](34 * $scale)) -FontWeight 600
    New-BGInfoLabel -Name ' ' -FontSize ([int](8 * $scale))
    New-BGInfoValue -Name 'Next booking' -Value $after
    New-BGInfoValue -Name 'Room' -Value $room.Seats
    New-BGInfoValue -Name 'Book it' -Value $room.Book
    New-BGInfoValue -Name 'Help' -Value 'ext. 4357, or help.contoso.com'

    # Right column: guest Wi-Fi on the phone, then how to share a screen.
    New-BGInfoQRCode -Region Right -Text $room.Wifi.Text -Title 'Guest Wi-Fi' `
        -Caption $room.Wifi.Ssid -Note 'scan to join' `
        -Height ([int](330 * $scale))
    New-BGInfoList -Region Right -Title 'Share your screen' -Marker Number `
        -Item $room.Steps

    # Bottom band: today in this room and the two next to it.
    if (@($day).Count -gt 0) {
        New-BGInfoTimeline -Region Bottom -Title 'Today' -NoLegend `
        -Note 'Bergen and Tromsø are next door' `
            -Item $day -Now $room.Now -Height ([int](280 * $scale))
    }
} -ConfigurationDirectory $OutputDirectory `
    -OutputFileName "meeting-room-$($Theme.ToLower()).png"
#endregion