Page 2 of 2 FirstFirst 12
  1.    29 Oct 2017 #11
    Join Date : Oct 2017
    Posts : 25
    Win 10 Pro

    After a closer look at Win 10 Powershell I see it has evolved and the DeviceManager addins are not needed. Big difference between Win 7 PS but I'm learning. The following script toggles touchscreen. If touchscreen is on, it disables it. If touchscreen is off, it attempts to enable it. It requires admin rights and the only qualifying it performs is identifying the touchscreen device. It is quick and dirty and may bomb when PS evolves. Tested and ran in PS ISE.

    Code:
    $TouchScreen = Get-PnpDevice -FriendlyName 'HID-Compliant Touch Screen'
    if ( $TouchScreen.Status -eq 'OK' ) { $TouchScreen | Disable-PnpDevice -confirm:$false }
     else { $TouchScreen | Enable-PnpDevice -confirm:$false }
      My ComputerSystem Spec
  2.    31 Oct 2017 #12
    Join Date : Apr 2015
    Posts : 307
    Windows 10 Home x64 and Pro x86

    xips,

    Thanks, I'll experiment with it. Oh & thanks for the links as well, they are interesting.

    And adding in elevation using one of the links you provided gives this as the final result [tested a few times already and it seems reliable] -

    # Escalate privileges if not admin
    If (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
    $Arguments = "& '" + $MyInvocation.mycommand.definition + "'"
    Start-Process powershell -Verb runAs -ArgumentList $Arguments
    Break
    }
    $TouchScreen = Get-PnpDevice -FriendlyName 'HID-Compliant Touch Screen'
    if ( $TouchScreen.Status -eq 'OK' ) { $TouchScreen | Disable-PnpDevice -confirm:$false } else { $TouchScreen | Enable-PnpDevice -confirm:$false }


    The system tray icon spacing does close up / open up as the touchscreen is disabled / re-enabled.

    Denis
      My ComputerSystem Spec

 
Page 2 of 2 FirstFirst 12


Similar Threads
Thread Forum
Solved Cannot change Windows 10 desktop icon spacing.
The tried and true method that worked for Vista and 7 does not seem to work with my Windows 10…using regedit then changing HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics values for IconSpacing and IconVerticalSpacing which must be between...
Customization
Solved Desktop icon spacing
I'm used to tweaking the values in HKCU\ControlPanel\Desktop\WindowsMetrics\Icon Spacing in previous version of Windows, but it appears to work a bit differently in Win10. Changing the Icon Spacing from the default of -1560 to, say -2000, gives...
Customization
Reserved Win10; yesterday sys tray icon disappeared
I reserved Windows 10 on or about July 20th, when the little GWX icon showed up in my system tray. I changed the email address on my Microsoft account last week. I hope this does not matter... I can still get mail at that address for another...
Windows Updates and Activation
Can't reserve windows 10, no icon in tray.
I used to have the icon in the system tray, however recently I needed to reset my computer so the reservation at the time was wiped. Having completed the reset I have now found that I cannot reserve a copy of windows 10 through control panel,...
Installation and Upgrade
Icon spacing
How can I space the icons on desktop? How can I make text bigger where I can read it OK? Like when I type in a web address in the bar. Some of my icons or huge and some are small. Please help Jaye
General Support
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 14:13.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums