PSVirtualDesktop icon indicating copy to clipboard operation
PSVirtualDesktop copied to clipboard

Set-DesktopName -Name "Name" only changes the GUI name

Open TechnoNotice opened this issue 1 year ago • 2 comments

When using Set-DesktopName -Name "Name" the name is not shown in Get-DesktopList. The name is shown when viewing available desktops by the GUI. The set name cannot be used by switch-Desktop but the name shown in Get-DesktopList can be used.

Command run as Local admin and RunAs Administrator Version tested: 1.5.7, 2024-02-15

PS C:\Users\LocalAdmin> Get-DesktopList

Number Name      Wallpaper Visible
------ ----      --------- -------
     0 Desktop 1              True


PS C:\Users\LocalAdmin> New-Desktop | Set-DesktopName -Name "TheNewOne"
PS C:\Users\LocalAdmin> Get-DesktopList

Number Name      Wallpaper Visible
------ ----      --------- -------
     0 Desktop 1              True
     1 Desktop 2             False

PS C:\Users\LocalAdmin> Switch-Desktop -name "TheNewOne"
Switch-Desktop : A parameter cannot be found that matches parameter name 'name'.
At line:1 char:16
+ Switch-Desktop -name "TheNewOne"
+                ~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Switch-Desktop], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Switch-Desktop

PS C:\Users\LocalAdmin> Switch-Desktop  "TheNewOne"
Switch-Desktop : No desktop with name part 'TheNewOne' found
At line:1 char:1
+ Switch-Desktop  "TheNewOne"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Switch-Desktop

PS C:\Users\LocalAdmin> Switch-Desktop  "Desktop 2"
Desktop Switched 

TechnoNotice avatar Apr 14 '24 12:04 TechnoNotice

Hello @TechnoNotice,

can you tell me which Windows version and which Powershell version you are running?

Greetings

Markus

MScholtes avatar Apr 15 '24 16:04 MScholtes

Appologies, was away. Im using Windows 11 and powershell version 5.1 build 22621 Rev 2506

PS C:\Users\LocalAdmin> [System.Environment]::OSVersion.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      22631  0


PS C:\Users\LocalAdmin> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      22621  2506

TechnoNotice avatar May 06 '24 21:05 TechnoNotice

Hello @TechnoNotice,

I have tried to reproduce the problem on a Windows 11 system. I was not able to do this, everything worked fine during my tests.

Can you check again if it works for you and determine the correct Windows version with Winver.exe (Powershell lies)?

Greetings

Markus

MScholtes avatar May 11 '24 16:05 MScholtes

Hi Markus, ersion according to Winver is Windows 11 Pro 23H2 (Build 22631.3447)
I have a second system running Windows 11 Home 23H2 (Build 22631.3527) which runs without problems.

I have a few ideas to test to see what may be the cause.
Logged on as limited user runnig terminal as administrator. Will test it logged on as admin user. Tripple screen setup. Will test with only one screen.

TechnoNotice avatar May 14 '24 21:05 TechnoNotice

Possible cause found . Tested on original machine when logged in as a user which is a memeber of the Administrators group. Everything works as expected. Switch back to user not a memeber of the Administrators group, problem returns.

TechnoNotice avatar May 14 '24 21:05 TechnoNotice

Hello @TechnoNotice,

tried this on my Windows 11 22631.3447 as Administrator and "normal user", everything works fine. Do you have some software restrictions like AppLocker or SRP on your machine or does your Virus scanner locks this down?

Greetings

Markus

MScholtes avatar May 16 '24 14:05 MScholtes

Hi, No App locker or other Software Restriction Policies. Machine is a private and not joined to a domain. Only virus scanner is Defender. I would expect that it wold block everything rather than just names.

TechnoNotice avatar May 20 '24 18:05 TechnoNotice

Hello @TechnoNotice,

the desktop names are stored under the registry key HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VirtualDesktops\Desktops, would you please check if this key exists on the computer and if there is a GUID key for every desktop underneath with the desktop name in it.

Greetings

Markus

MScholtes avatar May 26 '24 13:05 MScholtes

Yes, I do have the registry key in HKCU.

Unfortunately the issue has resolved itself. I think it was after I was testing with a single monitor. I will try to reproduce my setup at work to see if I can find any common issues.

TechnoNotice avatar Jun 02 '24 20:06 TechnoNotice