M
M
MODifikaTOR2021-12-21 15:18:44
PowerShell
MODifikaTOR, 2021-12-21 15:18:44

How can I show a message to a terminal server user?

I'm writing a script that will remind terminal server users about the imminent password expiration. I ran into a problem: I want the user to pop up a regular warning window (the msg command is not an option - it's ugly), but I can't find how to implement this. Does anyone have any experience they can share?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Bezrukov, 2021-12-21
@NortheR73

$msg = "Your password will expire in 5 days"
[System.Windows.MessageBox]::Show($msg,"Password Notification","OK","Warning")

V
Viktor, 2021-12-21
@MadLor

1. If ActiveDirectory, then why does the GPO not suit you? - Article
2. Or so:

[reflection.assembly]::loadwithpartialname('System.Windows.Forms')
[reflection.assembly]::loadwithpartialname('System.Drawing')
$notify = new-object system.windows.forms.notifyicon
$notify.icon = [System.Drawing.SystemIcons]::Information
$notify.visible = $true
$notify.showballoontip(10,'WARNING','Automatically logoff after 1 hour of inactivity',[system.windows.forms.tooltipicon]::None)

3. Well, or a very simple window:
#creating object os WScript
$wshell = New-Object -ComObject Wscript.Shell -ErrorAction Stop
#invoking the POP method using object
$wshell.Popup("please wait message?",5,"Wait Until Scrip execution",48+4)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question