{"id":14064272,"url":"https://github.com/MScholtes/PSVirtualDesktop","last_synced_at":"2025-07-29T17:33:07.608Z","repository":{"id":41444187,"uuid":"187496519","full_name":"MScholtes/PSVirtualDesktop","owner":"MScholtes","description":"VirtualDesktop is a Powershell module that provides commandlets to manage virtual desktops of Windows 10.","archived":false,"fork":false,"pushed_at":"2024-05-26T13:34:47.000Z","size":203,"stargazers_count":292,"open_issues_count":3,"forks_count":18,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-08-13T07:06:27.570Z","etag":null,"topics":["desktop","powershell","virtualdesktop"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MScholtes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-19T15:45:30.000Z","updated_at":"2024-08-13T07:06:30.449Z","dependencies_parsed_at":"2024-02-05T16:43:33.313Z","dependency_job_id":"2efa90a0-b50b-4438-ab9f-95021af36ffd","html_url":"https://github.com/MScholtes/PSVirtualDesktop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MScholtes%2FPSVirtualDesktop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MScholtes%2FPSVirtualDesktop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MScholtes%2FPSVirtualDesktop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MScholtes%2FPSVirtualDesktop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MScholtes","download_url":"https://codeload.github.com/MScholtes/PSVirtualDesktop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228032926,"owners_count":17858918,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["desktop","powershell","virtualdesktop"],"created_at":"2024-08-13T07:03:47.167Z","updated_at":"2025-07-29T17:33:07.596Z","avatar_url":"https://github.com/MScholtes.png","language":"PowerShell","funding_links":[],"categories":["PowerShell"],"sub_categories":[],"readme":"# VirtualDesktop\nVirtualDesktop is a Powershell module that provides commandlets to manage virtual desktops of Windows 10 and Windows 11.\n\n**Now with support for Windows 11 including Insider up to 24H2**\n\n**Now with support for Windows Server 2022**\n\n**Now with support for Powershell Core (pin application commandlets still not work here)**\n\n**Now with support for Windows Terminal**\n\n\n* New-Desktop, Switch-Desktop, Remove-Desktop to control desktops\n* Get-DesktopCount, Get-DesktopList, Get-CurrentDesktop, Get-Desktop and others to query desktops\n* Move-Window, (Un)Pin-Window, (Un)Pin-Application to control windows on desktops\n* only Windows 10 2004 and up: Get-DesktopName and Set-DesktopName\n* only Windows 11: Move-Desktop, Set-DesktopWallpaper and Set-AllDesktopWallpapers\n\nand other commandlets\n\nBy Markus Scholtes, 2025\n\n## Sample Session\n```powershell\n# Create a new virtual desktop and switch to it\nNew-Desktop | Switch-Desktop\n\n# Create a new virtual desktop and name it (only on Win 10 2004 or up)\nNew-Desktop | Set-DesktopName -Name \"The new one\"\n\n# Get second virtual desktop (count starts with 0) and remove it\nGet-Desktop 1 | Remove-Desktop -Verbose\n\n# Retrieves the count of virtual desktops\nGet-DesktopCount\n\n# Show list of virtual desktops\nGet-DesktopList\n\n# Move notepad window to current virtual desktop\n(ps notepad)[0].MainWindowHandle | Move-Window (Get-CurrentDesktop) | Out-Null\n\n# Move powershell window to last virtual desktop and switch to it\nGet-Desktop ((Get-DesktopCount)-1) | Move-Window (Get-ConsoleHandle) | Switch-Desktop\n\n# Retrieve virtual desktop on which notepad runs and switch to it\nGet-DesktopFromWindow ((Get-Process \"notepad\")[0].MainWindowHandle) | Switch-Desktop\n\n# Pin notepad to all desktops\nPin-Window ((Get-Process \"notepad\")[0].MainWindowHandle)\n```\n## Installation\n\n```powershell\nPS C:\\\u003e Install-Module VirtualDesktop\n```\nor download from here: https://www.powershellgallery.com/packages/VirtualDesktop/.\n\nAlso look for the script based version here [Powershell commands to manage virtual desktops of Windows 10](https://github.com/MScholtes/TechNet-Gallery/tree/master/VirtualDesktop).\n\nAlso look for the C# partner tool here [VirtualDesktop](https://github.com/MScholtes/VirtualDesktop).\n\n## List Of Commands\nIn most commands you can use a desktop object, the desktop number or a part of the desktop name as parameter desktop, see online help for more information.\n\n### Get-DesktopCount\nGet count of virtual desktops\n### Get-DesktopList\nShow list of virtual desktops\n### New-Desktop\nCreate virtual desktop. Returns desktop object.\n### Switch-Desktop -Desktop desktop -NoAnimation\nSwitch to virtual desktop. Parameter is number of desktop (starting with 0 to count-1), desktop object or string (part of desktop name). Parameter -NoAnimation only on Windows 11.\n### Remove-Desktop -Desktop desktop\nRemove virtual desktop. Parameter is number of desktop (starting with 0 to count-1), desktop object or string (part of desktop name).\nWindows on the desktop to be removed are moved to the virtual desktop to the left except for desktop 0 where the\nsecond desktop is used instead. If the current desktop is removed, this fallback desktop is activated too.\nIf no parameter is supplied, the last desktop is removed.\n### Remove-AllDesktops\nRemove all virtual desktops but visible.\n### Get-CurrentDesktop\nGet current virtual desktop as desktop object.\n### Get-Desktop -Index index\nGet virtual desktop with index number (0 to count-1). Returns desktop object.\n### Get-DesktopIndex -Desktop desktop\nGet index number (0 to count-1) of virtual desktop. Returns integer or -1 if not found.\n### Get-DesktopName -Desktop desktop\nGet name of virtual desktop. Returns string.\n### Set-DesktopName -Desktop desktop -Name name -PassThru\nSet name of virtual desktop to name. Works only with Windows 10 2004 or up.\n### Set-DesktopWallpaper -Desktop desktop -Path path -PassThru\nSet wallpaper of virtual desktop to path. Works only with Windows 11.\n### Set-AllDesktopWallpapers -Path path\nSet wallpaper of all virtual desktops to path. Works only with Windows 11.\n### Get-DesktopFromWindow -Hwnd hwnd\nGet virtual desktop of window (whose window handle is passed). Returns desktop object.\n### Test-CurrentDesktop -Desktop desktop\nChecks whether a desktop is the currently displayed virtual desktop. Returns boolean.\n### Get-LeftDesktop -Desktop desktop\nGet the desktop object on the \"left\" side. If there is no desktop on the \"left\" side $NULL is returned.\nReturns desktop \"left\" to current desktop if parameter desktop is omitted.\n### Get-RightDesktop -Desktop desktop\nGet the desktop object on the \"right\" side.If there is no desktop on the \"right\" side $NULL is returned.\nReturns desktop \"right\" to current desktop if parameter desktop is omitted.\n### Move-Desktop -Desktop desktop\nMove current desktop to other virtual desktop. Works only with Windows 11.\n### Move-Window -Desktop desktop -Hwnd hwnd\nMove window whose handle is passed to virtual desktop.\nThe parameter values are auto detected and can change places. The desktop object is handed to the output pipeline for further use.\nIf parameter desktop is omitted, the current desktop is used.\n### Move-ActiveWindow -Desktop desktop\nMove active window to virtual desktop.\nThe desktop object is handed to the output pipeline for further use.\nIf parameter desktop is omitted, the current desktop is used.\n### Test-Window -Desktop desktop -Hwnd hwnd\nCheck if window whose handle is passed is displayed on virtual desktop. Returns boolean.\nThe parameter values are auto detected and can change places. If parameter desktop is not supplied, the current desktop is used.\n### Pin-Window -Hwnd hwnd\nPin window whose window handle is given to all desktops.\n### Pin-ActiveWindow\nPin active window to all desktops.\n### Unpin-Window -Hwnd hwnd\nUnpin window whose window handle is given to all desktops.\n### Unpin-ActiveWindow\nUnpin active window from all desktops.\n### Test-WindowPinned -Hwnd hwnd\nChecks whether a window whose window handle is given is pinned to all desktops. Returns boolean.\n### Pin-Application -Hwnd hwnd\nPin application whose window handle is given to all desktops.\n### Unpin-Application -Hwnd hwnd\nUnpin application whose window handle is given to all desktops.\n### Test-ApplicationPinned -Hwnd hwnd\nChecks whether an application whose window handle is given is pinned to all desktops. Returns boolean.\n### Get-ConsoleHandle\nGet window handle of powershell console in a safe way (means: if powershell is started in a cmd window, the cmd window handle is returned).\n### Get-ActiveWindowHandle\nGet window handle of foreground window (the foreground window is always on the current virtual desktop).\n### Find-WindowHandle\nFind first window handle to title text or retrieve list of windows with title (when called with * as parameter)\n\n## Versions\n### 1.5.10, 2025-03-03\n- new commands Pin-ActiveWindow and Unpin-ActiveWindow\n- Windows 11: parameter -NoAnimation for Switch-Desktop\n### 1.5.9, 2024-09-01\n- faster API call FindWindow\n- Windows 11: animated switch to new desktop\n### 1.5.8, 2024-05-26\n- changes for Win 11 24H2 and fixing of messages\n### 1.5.7, 2024-02-15\n- changes for Win 11 3085 and up\n### 1.5.6, 2023-09-18\n- bug fix for Win 11 Insider Canary\n- Remove-AllDesktops for all versions\n### 1.5.5, 2023-09-02\n- bug fix for Win 11 22H2 Build 22621.2215\n### 1.5.4, 2023-08-27\n- integration of Win 11 22H2 Build 22621.2215 and Insider versions\n- Remove-AllDesktops without function on Win 11 22H2 Build 22621.2215 and Insider versions (will soon be fixed)\n### 1.5.3, 2023-06-11\n- no flashing icons after switch desktops\n### 1.5.2, 2023-02-19\n- support for Windows 11 Insider 25276+\n### 1.5.1, 2022-07-29\n- bug fix: desktop for pinned windows and apps are recognized\n### 1.5.0, 2022-03-16\n- support for Powershell Core\n- support for Windows Server 2022\n- support for Windows Terminal\n### 1.4.1, 2021-11-27\n- support for Windows 11 Insider build 22449 and up\n- version 1.3.2 should have been 1.4.0, so this is 1.4.1\n### 1.3.2, 2021-10-22\n- support for Windows 10 21H2 and Windows 11\n- Set-DesktopName works on current virtual desktop if parameter -desktop is missing\n### 1.3.1, 2021-02-28\n- fixes for Get-DesktopIndex\n### 1.3.0, 2020-11-28\n- compatible to Powershell Core 7.0 (but not 7.1 or up)\n- parameter -PassThru for Set-DesktopName (by sirAndros)\n### 1.2.0, 2020-06-27\n- support for desktop names introduced with Win 10 2004\n- new functions Get-DesktopList, Get-DesktopName and Set-DesktopName\n- desktop name as parameter for many functions\n- support for verbose output\n### 1.1.0, 2019-09-04\n- new function Find-WindowHandle\n### 1.0.1, 2019-08-22\n- fixed examples\n### 1.0.0, 2019-06-03\n- first stable release (hope so)\n### 0.0.0, 2019-05-20\n- test release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMScholtes%2FPSVirtualDesktop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMScholtes%2FPSVirtualDesktop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMScholtes%2FPSVirtualDesktop/lists"}