Información
- https://www.jesusninoc.com/01/30/enviar-un-mensaje-udp-a-un-ordenador-desde-powershell/
- https://www.jesusninoc.com/02/12/crear-una-windows-presentation-foundation-wpf-ventana-en-powershell-de-forma-simple-y-sencilla/
Cliente envía la ventana
1 2 3 4 5 6 7 |
$ip = New-Object System.Net.IPEndPoint ([IPAddress]::Loopback,2020) $udp = New-Object System.Net.Sockets.UdpClient # Enviar la ventana $mensaje = [Text.Encoding]::ASCII.GetBytes('($window = [System.Windows.Window] @{Title = "Mi formulario"; Background = [System.Windows.Media.Brushes]::Red}).ShowDialog()') $udp.Send($mensaje,$mensaje.length,$ip) | Out-Null $udp.Close() |
Servidor recibe la ventana
1 2 3 4 5 |
$ip = New-Object System.Net.IPEndPoint ([IPAddress]::Loopback,0) $udp = New-Object System.Net.Sockets.UdpClient 2020 $ventana = [Text.Encoding]::ASCII.GetString($udp.Receive([ref]$ip)) $ventana | iex $udp.Close() |
Resultado
