Hi,

Need help to check is the syntax correct:

WshShell.RegWrite
"HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\ActiveDesktop"
"NoDeletingComponents"=dword:00000001
"NoEditingComponents"=dword:00000001
"NoCloseDragDropBands"=dword:00000001
"NoMovingBands"=dword:00000001

Set WSHShell = CreateObject("WScript.Shell")
WSHShell.Run "RUNDLL32.EXE Shell32.dll,SHExitWindowsEx 0"

WScript.quit


Is it OK?

Re: Is the syntax correct? by mistral

mistral
Tue Sep 12 04:50:13 CDT 2006


"Alexander Mueller" <millerax@hotmail.com> wrote in message
news:4505dfa2$0$18479$9b4e6d93@newsspool3.arcor-online.net...
> 11.09.2006 20:20, mistral schrieb:
>
>> Need help to check is the syntax correct:
>>
>> WshShell.RegWrite
>> "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\ActiveDesktop"
>> "NoDeletingComponents"=dword:00000001
>> "NoEditingComponents"=dword:00000001
>> "NoCloseDragDropBands"=dword:00000001
>> "NoMovingBands"=dword:00000001
>>
>> Set WSHShell = CreateObject("WScript.Shell")
>> WSHShell.Run "RUNDLL32.EXE Shell32.dll,SHExitWindowsEx 0"
>>
>> WScript.quit
>>
>>
>> Is it OK?
>
> No
>
> The RegWrite-part uses argument-syntax for REGEDIT4-scripts (*.reg)
> For pure scripting you must put it into multiple calls:
>
> Set WSHShell = CreateObject("WScript.Shell")
> Const adKey =
> "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\ActiveDesktop\"
>
> WshShell.RegWrite adKey & "NoDeletingComponents", 1, "REG_DWORD"
> WshShell.RegWrite adKey & "NoEditingComponents", 1, "REG_DWORD"
> WshShell.RegWrite adKey & "NoCloseDragDropBands", 1, "REG_DWORD"
> WshShell.RegWrite adKey & "NoMovingBands", 1, "REG_DWORD"
>
> The Shutdown-command is syntactically ok, but iirc is no longer supported
> under XP (assuming XP is your OS). Use either WMI-Win32_Shutdown or the
> shell-util shutdown.exe for system-shutdown.
>
> MfG,
> Alex
---------------

Thanks for tipps.
In final part i meant Log off, not shutdown. Does anyone suggest a way to do
it in Vbscript. Thank you


Re: Is the syntax correct? by Steven

Steven
Tue Sep 12 05:23:02 CDT 2006

"mistral" <mistral@msnews.microsoft.com> wrote in message
news:edSMbDl1GHA.1300@TK2MSFTNGP05.phx.gbl...
> In final part i meant Log off, not shutdown. Does anyone suggest a way to
do
> it in Vbscript. Thank you

http://groups.google.co.uk/group/microsoft.public.scripting.vbscript/browse_thread/thread/dacfb842cc2f64d2/d6c304eca5777249?lnk=st&q=vbscript+logoff+windows+xp&rnum=1&hl=en#d6c304eca5777249

Watch for line wrap in the above link, or use the following;

http://surl.co.uk/?3734

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!



Re: Is the syntax correct? by Alexander

Alexander
Tue Sep 12 05:31:53 CDT 2006

mistral schrieb:
>
> Thanks for tipps.
> In final part i meant Log off, not shutdown. Does anyone suggest a way
> to do it in Vbscript. Thank you



'@From the Michael Harris-fund of kind scripting-donations

Const EWX_LOGOFF = 0

Set wmi = GetObject("winmgmts:{(Shutdown)}")
Set objSet = wmi.InstancesOf("Win32_OperatingSystem")

For Each obj in objSet
Set os = obj
Exit For
Next

os.Win32Shutdown EWX_LOGOFF

Re: Is the syntax correct? by mistral

mistral
Tue Sep 12 06:35:54 CDT 2006


"Steven Burn" <somewhere@in-time.invalid> wrote in message
news:eHc1wUl1GHA.1256@TK2MSFTNGP04.phx.gbl...
> "mistral" <mistral@msnews.microsoft.com> wrote in message
> news:edSMbDl1GHA.1300@TK2MSFTNGP05.phx.gbl...
>> In final part i meant Log off, not shutdown. Does anyone suggest a way to
> do
>> it in Vbscript. Thank you

http://groups.google.co.uk/group/microsoft.public.scripting.vbscript/browse_thread/thread/dacfb842cc2f64d2/d6c304eca5777249?lnk=st&q=vbscript+logoff+windows+xp&rnum=1&hl=en#d6c304eca5777249> Watch for line wrap in the above link, or use the following;> http://surl.co.uk/?3734> --> Regards> Steven Burn> Ur I.T. Mate Group> www.it-mate.co.uk> Keeping it FREE!-------------OK, this is frequently asked question (the WMI docs for Win32Shutdown arecontradictory sometimes).Is the following correct:----code----Set wmi = GetObject("winmgmts:{(Shutdown)}")set objset = wmi.instancesof("win32_operatingsystem")for each obj in objset set os = obj : exit fornextConst EWX_LOGOFF = 0Const EWX_SHUTDOWN = 1Const EWX_REBOOT = 2Const EWX_FORCE = 4Const EWX_POWEROFF = 8os.win32shutdown EWX_LOGOFFend if--- code---------------thanks.

Re: Is the syntax correct? by Mistral

Mistral
Tue Sep 12 08:14:17 CDT 2006


"Alexander Mueller" <millerax@hotmail.com> wrote in message
news:%23U6Vral1GHA.1304@TK2MSFTNGP05.phx.gbl...
> mistral schrieb:

Thanks for tipps. In final part i meant Log off, not shutdown. Does anyone
suggest a way to do it in Vbscript. Thank you



> '@From the Michael Harris-fund of kind scripting-donations

> Const EWX_LOGOFF = 0

> Set wmi = GetObject("winmgmts:{(Shutdown)}")
> Set objSet = wmi.InstancesOf("Win32_OperatingSystem")

> For Each obj in objSet
> Set os = obj
> Exit For
> Next

> os.Win32Shutdown EWX_LOGOFF


------------
Thanks. Still note, how to complete script and exit? WScript.Quit ?

os.Win32Shutdown EWX_LOGOFF
WScript.Quit



Re: Is the syntax correct? by Alexander

Alexander
Wed Sep 13 07:10:03 CDT 2006

Mistral schrieb:

>> '@From the Michael Harris-fund of kind scripting-donations
>
>> Const EWX_LOGOFF = 0
>
>> Set wmi = GetObject("winmgmts:{(Shutdown)}")
>> Set objSet = wmi.InstancesOf("Win32_OperatingSystem")
>
>> For Each obj in objSet
>> Set os = obj
>> Exit For
>> Next
>
>> os.Win32Shutdown EWX_LOGOFF
>
>
> ------------
> Thanks. Still note, how to complete script and exit? WScript.Quit ?
>
> os.Win32Shutdown EWX_LOGOFF
> WScript.Quit

Yes Wscript.Quit ends script-execution.

But script-execution ends anyway if there is no more code to execute
or if the machine shuts down or the user logs off.

MfG,
Alex