DBThomson76
asked on
Windows Form on Remote Computer
Is it possible to have a Windows Form sent to a remoter computer?
This is the code that I was able to put together that show a form on my computer. I am trying to figure out how (if possible to send this to a remote computer:
Add-Type -AssemblyName System.Windows.Forms
$Form = New-Object system.Windows.Forms.Form
$Form.Text = "Reboot Message"
$Icon = [system.drawing.icon]::Ext ractAssoci atedIcon($ PSHOME + "\powershell.exe")
$Form.Icon = $Icon
$Form.AutoSize = $True
$Form.AutoSizeMode = "GrowAndShrink"
# or GrowOnly
#$Form.AutoScroll = $True
$Form.BackColor = "Red"
# color names are static properties of System.Drawing.Color
# you can also use ARGB values, such as "#FFFFEBCD"
#$Form.Opacity = 0.7
# 1.0 is fully opaque; 0.0 is invisible
$Form.StartPosition = "CenterScreen"
# CenterScreen, Manual, WindowsDefaultLocation, WindowsDefaultBounds, CenterParent
$Font = New-Object System.Drawing.Font("Times New Roman",24,[System.Drawing. FontStyle] ::Italic)
# Font styles are: Regular, Bold, Italic, Underline, Strikeout
$Form.Font = $Font
$Label = New-Object System.Windows.Forms.Label
$Label.Text = "Please reboot your computer at your earliest convenience, Thank you!"
$Label.AutoSize = $True
$Form.Controls.Add($Label)
$Form.ShowDialog()
TIA!
This is the code that I was able to put together that show a form on my computer. I am trying to figure out how (if possible to send this to a remote computer:
Add-Type -AssemblyName System.Windows.Forms
$Form = New-Object system.Windows.Forms.Form
$Form.Text = "Reboot Message"
$Icon = [system.drawing.icon]::Ext
$Form.Icon = $Icon
$Form.AutoSize = $True
$Form.AutoSizeMode = "GrowAndShrink"
# or GrowOnly
#$Form.AutoScroll = $True
$Form.BackColor = "Red"
# color names are static properties of System.Drawing.Color
# you can also use ARGB values, such as "#FFFFEBCD"
#$Form.Opacity = 0.7
# 1.0 is fully opaque; 0.0 is invisible
$Form.StartPosition = "CenterScreen"
# CenterScreen, Manual, WindowsDefaultLocation, WindowsDefaultBounds, CenterParent
$Font = New-Object System.Drawing.Font("Times
# Font styles are: Regular, Bold, Italic, Underline, Strikeout
$Form.Font = $Font
$Label = New-Object System.Windows.Forms.Label
$Label.Text = "Please reboot your computer at your earliest convenience, Thank you!"
$Label.AutoSize = $True
$Form.Controls.Add($Label)
$Form.ShowDialog()
TIA!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you could invoke-command on the remote computer.
i.e. Invoke-Command -Computername $RemoteComputer -ScriptBlock { Get-ChildItem "C:\Program Files" }
i.e. Invoke-Command -Computername $RemoteComputer -ScriptBlock { Get-ChildItem "C:\Program Files" }
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The author closes the question by selecting one or more answers as solutions or helpful posts.
Do not mark your comment as the solution, mark the post that actually helped you. This will help someone in the future to see the solution. Thanks.
ASKER
Please let me know if it is not possible to use PowerShell to run this Windows Form to a remote computer.
Thank you!