Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista General Discussion > How can I force a LockWorkstation from a Windows Service on Vista?

Reply
Thread Tools Display Modes

How can I force a LockWorkstation from a Windows Service on Vista?

 
 
Malignonne
Guest
Posts: n/a

 
      03-13-2008
Hello,
I have written a Credential Provider which requires a secure token to be
present. This works fine. I have written a Windows Service which periodically
scans for the secure token presence. This works fine.

HOWEVER ....

What I would like to be able to do is to lock the workstation (go back to
the logon screen) if my Windows Service notices that the secure token is no
longer present.

How can I do this (I've been trawling through the web and haven't found
anything I can use).

I've tried running the Windows Service both as a User and as a LocalService.

Any suggestions would be very gratefully received!
 
Reply With Quote
 
 
 
 
Mark L. Ferguson
Guest
Posts: n/a

 
      03-14-2008
Use this command : %windir%\System32\rundll32.exe user32.dll,LockWorkStation

--
Was this helpful? Then click the Ratings button. Voting helps the web
interface.
http://www.microsoft.com/wn3/locales...eAPostAsAnswer
Mark L. Ferguson
..

"Malignonne" <> wrote in message
news:E76079B5-90B2-4724-AB55-...
> Hello,
> I have written a Credential Provider which requires a secure token to be
> present. This works fine. I have written a Windows Service which
> periodically
> scans for the secure token presence. This works fine.
>
> HOWEVER ....
>
> What I would like to be able to do is to lock the workstation (go back to
> the logon screen) if my Windows Service notices that the secure token is
> no
> longer present.
>
> How can I do this (I've been trawling through the web and haven't found
> anything I can use).
>
> I've tried running the Windows Service both as a User and as a
> LocalService.
>
> Any suggestions would be very gratefully received!


 
Reply With Quote
 
Malignonne
Guest
Posts: n/a

 
      03-14-2008
Thanks Mark,

That was one I had already tried!

The command works fine from a console window, but not from a Windows
Service. For example:

HINSTANCE x = ShellExecute(NULL, NULL, "rundll32.exe",
"user32.dll,LockWorkStation", NULL, 0);

returns x = 42, which indicates success. However, the workstation is not
locked.

It looks like a security problem of some sort (I've tried running the
service as Local Server and a Remote Service too, but there is no change)

Regards
Ben



"Mark L. Ferguson" wrote:

> Use this command : %windir%\System32\rundll32.exe user32.dll,LockWorkStation
>
> --
> Was this helpful? Then click the Ratings button. Voting helps the web
> interface.
> http://www.microsoft.com/wn3/locales...eAPostAsAnswer
> Mark L. Ferguson
> .
>
> "Malignonne" <> wrote in message
> news:E76079B5-90B2-4724-AB55-...
> > Hello,
> > I have written a Credential Provider which requires a secure token to be
> > present. This works fine. I have written a Windows Service which
> > periodically
> > scans for the secure token presence. This works fine.
> >
> > HOWEVER ....
> >
> > What I would like to be able to do is to lock the workstation (go back to
> > the logon screen) if my Windows Service notices that the secure token is
> > no
> > longer present.
> >
> > How can I do this (I've been trawling through the web and haven't found
> > anything I can use).
> >
> > I've tried running the Windows Service both as a User and as a
> > LocalService.
> >
> > Any suggestions would be very gratefully received!

>

 
Reply With Quote
 
Mark L. Ferguson
Guest
Posts: n/a

 
      03-14-2008
It's probably a rights problem. Would the command :
shutdown /L /T 00
do anything for you?
--
Was this helpful? Then click the Ratings button. Voting helps the web
interface.
http://www.microsoft.com/wn3/locales...eAPostAsAnswer
Mark L. Ferguson
..

"Malignonne" <> wrote in message
news:3EFFCDF4-C121-4EB9-A629-...
> Thanks Mark,
>
> That was one I had already tried!
>
> The command works fine from a console window, but not from a Windows
> Service. For example:
>
> HINSTANCE x = ShellExecute(NULL, NULL, "rundll32.exe",
> "user32.dll,LockWorkStation", NULL, 0);
>
> returns x = 42, which indicates success. However, the workstation is not
> locked.
>
> It looks like a security problem of some sort (I've tried running the
> service as Local Server and a Remote Service too, but there is no change)
>
> Regards
> Ben
>
>
>
> "Mark L. Ferguson" wrote:
>
>> Use this command : %windir%\System32\rundll32.exe
>> user32.dll,LockWorkStation
>>
>> --
>> Was this helpful? Then click the Ratings button. Voting helps the web
>> interface.
>> http://www.microsoft.com/wn3/locales...eAPostAsAnswer
>> Mark L. Ferguson
>> .
>>
>> "Malignonne" <> wrote in message
>> news:E76079B5-90B2-4724-AB55-...
>> > Hello,
>> > I have written a Credential Provider which requires a secure token to
>> > be
>> > present. This works fine. I have written a Windows Service which
>> > periodically
>> > scans for the secure token presence. This works fine.
>> >
>> > HOWEVER ....
>> >
>> > What I would like to be able to do is to lock the workstation (go back
>> > to
>> > the logon screen) if my Windows Service notices that the secure token
>> > is
>> > no
>> > longer present.
>> >
>> > How can I do this (I've been trawling through the web and haven't found
>> > anything I can use).
>> >
>> > I've tried running the Windows Service both as a User and as a
>> > LocalService.
>> >
>> > Any suggestions would be very gratefully received!

>>

 
Reply With Quote
 
Malignonne
Guest
Posts: n/a

 
      03-14-2008
This doesn't work either, even if I put it in a bat file and run that.

I agree that it is a rights problem.

The problem is how do I resolve it?!


"Mark L. Ferguson" wrote:

> It's probably a rights problem. Would the command :
> shutdown /L /T 00
> do anything for you?
> --
> Was this helpful? Then click the Ratings button. Voting helps the web
> interface.
> http://www.microsoft.com/wn3/locales...eAPostAsAnswer
> Mark L. Ferguson
> ..
>
> "Malignonne" <> wrote in message
> news:3EFFCDF4-C121-4EB9-A629-...
> > Thanks Mark,
> >
> > That was one I had already tried!
> >
> > The command works fine from a console window, but not from a Windows
> > Service. For example:
> >
> > HINSTANCE x = ShellExecute(NULL, NULL, "rundll32.exe",
> > "user32.dll,LockWorkStation", NULL, 0);
> >
> > returns x = 42, which indicates success. However, the workstation is not
> > locked.
> >
> > It looks like a security problem of some sort (I've tried running the
> > service as Local Server and a Remote Service too, but there is no change)
> >
> > Regards
> > Ben
> >
> >
> >
> > "Mark L. Ferguson" wrote:
> >
> >> Use this command : %windir%\System32\rundll32.exe
> >> user32.dll,LockWorkStation
> >>
> >> --
> >> Was this helpful? Then click the Ratings button. Voting helps the web
> >> interface.
> >> http://www.microsoft.com/wn3/locales...eAPostAsAnswer
> >> Mark L. Ferguson
> >> .
> >>
> >> "Malignonne" <> wrote in message
> >> news:E76079B5-90B2-4724-AB55-...
> >> > Hello,
> >> > I have written a Credential Provider which requires a secure token to
> >> > be
> >> > present. This works fine. I have written a Windows Service which
> >> > periodically
> >> > scans for the secure token presence. This works fine.
> >> >
> >> > HOWEVER ....
> >> >
> >> > What I would like to be able to do is to lock the workstation (go back
> >> > to
> >> > the logon screen) if my Windows Service notices that the secure token
> >> > is
> >> > no
> >> > longer present.
> >> >
> >> > How can I do this (I've been trawling through the web and haven't found
> >> > anything I can use).
> >> >
> >> > I've tried running the Windows Service both as a User and as a
> >> > LocalService.
> >> >
> >> > Any suggestions would be very gratefully received!
> >>

>

 
Reply With Quote
 
Mark L. Ferguson
Guest
Posts: n/a

 
      03-14-2008
A shortcut can be set to 'run as administrator' and you could launch the bat
file from that.
bat_file_start.lnk/Properties.
There is probably a way to 'impersonate' in the VB code, but I don't know
that.
--
Was this helpful? Then click the Ratings button. Voting helps the web
interface.
http://www.microsoft.com/wn3/locales...eAPostAsAnswer
Mark L. Ferguson
..

"Malignonne" <> wrote in message
news:BC1B829B-95CF-4048-8EB3-...
> This doesn't work either, even if I put it in a bat file and run that.
>
> I agree that it is a rights problem.
>
> The problem is how do I resolve it?!
>
>
> "Mark L. Ferguson" wrote:
>
>> It's probably a rights problem. Would the command :
>> shutdown /L /T 00
>> do anything for you?
>> --
>> Was this helpful? Then click the Ratings button. Voting helps the web
>> interface.
>> http://www.microsoft.com/wn3/locales...eAPostAsAnswer
>> Mark L. Ferguson
>> ..
>>
>> "Malignonne" <> wrote in message
>> news:3EFFCDF4-C121-4EB9-A629-...
>> > Thanks Mark,
>> >
>> > That was one I had already tried!
>> >
>> > The command works fine from a console window, but not from a Windows
>> > Service. For example:
>> >
>> > HINSTANCE x = ShellExecute(NULL, NULL, "rundll32.exe",
>> > "user32.dll,LockWorkStation", NULL, 0);
>> >
>> > returns x = 42, which indicates success. However, the workstation is
>> > not
>> > locked.
>> >
>> > It looks like a security problem of some sort (I've tried running the
>> > service as Local Server and a Remote Service too, but there is no
>> > change)
>> >
>> > Regards
>> > Ben
>> >
>> >
>> >
>> > "Mark L. Ferguson" wrote:
>> >
>> >> Use this command : %windir%\System32\rundll32.exe
>> >> user32.dll,LockWorkStation
>> >>
>> >> --
>> >> Was this helpful? Then click the Ratings button. Voting helps the web
>> >> interface.
>> >> http://www.microsoft.com/wn3/locales...eAPostAsAnswer
>> >> Mark L. Ferguson
>> >> .
>> >>
>> >> "Malignonne" <> wrote in message
>> >> news:E76079B5-90B2-4724-AB55-...
>> >> > Hello,
>> >> > I have written a Credential Provider which requires a secure token
>> >> > to
>> >> > be
>> >> > present. This works fine. I have written a Windows Service which
>> >> > periodically
>> >> > scans for the secure token presence. This works fine.
>> >> >
>> >> > HOWEVER ....
>> >> >
>> >> > What I would like to be able to do is to lock the workstation (go
>> >> > back
>> >> > to
>> >> > the logon screen) if my Windows Service notices that the secure
>> >> > token
>> >> > is
>> >> > no
>> >> > longer present.
>> >> >
>> >> > How can I do this (I've been trawling through the web and haven't
>> >> > found
>> >> > anything I can use).
>> >> >
>> >> > I've tried running the Windows Service both as a User and as a
>> >> > LocalService.
>> >> >
>> >> > Any suggestions would be very gratefully received!
>> >>

>>

 
Reply With Quote
 
Malignonne
Guest
Posts: n/a

 
      03-14-2008

Still no joy, I'm afraid. Trying to run the shortcut from the service
returns an error of 2.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Force Vista to Dump Qwiit Windows Vista General Discussion 5 03-04-2008 03:59 PM
The Windows Firewall service terminated with service-specific erro DaMnIt Windows Vista Security 7 10-10-2007 05:34 PM
Please, give me a shortcut to force a restart to Windows Explorer Juan I. Cahis Windows Vista General Discussion 5 08-20-2007 08:30 PM
Security Service and Windows Wireless Service stopped working Kolin Tregaskes Windows Vista General Discussion 3 06-11-2007 05:34 PM
Windows Boot Manager - how to force the BIOS calls for display ? Zdenek Hrib Windows Vista Installation 9 03-23-2007 12:58 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59