Yep, the send button is my favorite source of info. Works every time.

From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On 
Behalf Of James Rankin
Sent: Thursday, October 03, 2013 8:38 AM
To: NTSysADM@lists.myitforum.com
Subject: Re: [NTSysADM] PowerShell (again)

Just as you post, a solution presents itself :-0

$a = new-object -comobject wscript.shell
$b = $a.popup("This is a test",0,"Test Message Box",1)

On 3 October 2013 13:31, James Rankin 
<kz2...@googlemail.com<mailto:kz2...@googlemail.com>> wrote:
Is it possible to use PowerShell to display a message to a user and then log 
them out? My scenario is this:-

Got to deliver three distinct desktops from one single image. The access to the 
desktops is controlled via AD group, so if you are in the Warehouse group, you 
get the Warehouse desktop. Now, for obvious reasons, I'd sooner have separated 
this by OU, because a user can only ever be in one OU, but the client doesn't 
want to do it this way. So if, for whatever reason, a user is erroneously added 
to two of the AD security groups, we want to halt the logon, display a message, 
and log the user out. Otherwise they will get a hotch-potch of settings which 
will look messy and behave in ways we can't predict, as two flavours of desktop 
try to override each other.

The bit to check whether a user is in more than one of the three groups I can 
handle :-) It's the next bit giving me issues. I can't really find any reliable 
way to do the message box by Googling, and although I could do it with VBScript 
that feels like admitting defeat. Is there a good way to deliver a message box 
(just with an "OK" response) in PS?

To log them out, I am assuming I could just call the Windows logoff.exe when 
the message box is gone. Unless there's a way to do logoffs native to PS?

Thanks for the continued help with my battle to learn PS properly :-(

Cheers,



--
James Rankin
Technical Consultant (ACA, CCA, MCTS)
http://appsensebigot.blogspot.co.uk



--
James Rankin
Technical Consultant (ACA, CCA, MCTS)
http://appsensebigot.blogspot.co.uk

Reply via email to