powershell - Remote user input -


would possible generate popup @ remote computer requires (remote) user input? let's use powershell execute script on remote computer , want active user behind computer accept running script. i'f isn't possible default, there simple third party solutions (that require no installation on remote users computer) use achieve same goal?

thinking out of box use powershell send mail , scan incoming replies, feels inefficient.

i'm close making using toast messages api uwp. can create toast messages buttons , textboxes (also on remote machine using invoke-command), have been unsuccesfull in getting results inputs or buttons (and going through uwp documentation looks not possible powershell).

sample code i've been working on (look through documentation of toast messages in uwp more info - version allows run local or remote. i've not included xml content button that's easy implement if follow api documentation microsoft wrote) - maybe you'll have more luck (disclaimer : first working concept, code isn't optimized yet, lot of duplicate code "local" , "remote" version etc.) :

function invoke-toastmessage { [cmdletbinding()]     param         (         [string]$message,         [string]$notifier = "administrators",         [string]$computername = $null         )  [scriptblock]$toastscriptremote = { $message = $args[0] $notifier = $args[1] # xml template [xml]$xmltemplate = @" <toast scenario="reminder">   <visual>     <binding template="toastgeneric">       <text>admin notification</text>       <text>$message</text>     </binding>   </visual>   <actions>   </actions> </toast> "@     # fake load assemblies     [void][windows.ui.notifications.toastnotification,windows.ui.notifications,contenttype=windowsruntime]     [void][windows.data.xml.dom.xmldocument,windows.data.xml.dom,contenttype=windowsruntime]     $finalxml = [windows.data.xml.dom.xmldocument]::new()     $finalxml.loadxml($xmltemplate.outerxml)     ## create toast     $toast = [windows.ui.notifications.toastnotification]::new($finalxml)     ## show toast message     [windows.ui.notifications.toastnotificationmanager]::createtoastnotifier($notifier).show($toast)     }  [scriptblock]$toastscriptlocal = { # xml template [xml]$xmltemplate = @" <toast scenario="reminder">   <visual>     <binding template="toastgeneric">       <text>admin notification</text>       <text>$message</text>     </binding>   </visual>   <actions>   </actions> </toast> "@     # fake load assemblies     [void][windows.ui.notifications.toastnotification,windows.ui.notifications,contenttype=windowsruntime]     [void][windows.data.xml.dom.xmldocument,windows.data.xml.dom,contenttype=windowsruntime]     $finalxml = [windows.data.xml.dom.xmldocument]::new()     $finalxml.loadxml($xmltemplate.outerxml)     ## create toast     $toast = [windows.ui.notifications.toastnotification]::new($finalxml)     ## show toast message     [windows.ui.notifications.toastnotificationmanager]::createtoastnotifier($notifier).show($toast)     }  if (![string]::isnullorempty($computername))     {         invoke-command -computername $computername -scriptblock $toastscriptremote -argumentlist $message,$notifier     }     else {$toastscriptlocal.invoke()} } 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -