On Jun 4, 3:28 am, paroots <paro...@discussions.microsoft.com> wrote:
> Thanks again solon fox. Your latest script still generates an error on my
> Windows Vista Home Premium 32 bit computer. Here is the script I'm testing
> (between the hyphens):
> --------------
> 'Script to shutdown using shell32
>
> 'Defines and creates the shell object for later use so we can call it
> Set oWshShell = WScript.CreateObject("WScript.Shell")
>
> 'This will shutdown the computer. calls the method shell32.dll.
> oWshShell.Run "RunDll32.exe shell32.dll,SHExitWindowsEx 1"
> -------------
>
> and here is the error message received:
> ------------
> Error in shell32.dll
> Missing entry:SHExitWondowsEx
> ------------
Well, it is clearly not you. They have changed shell32.dll - even
though the method is still in my Vista Ultimate version. I would try
the more modern version using the WMI that I posted previously.
'BEGIN Copy below this line -
Const SHUTDOWN = 1
strComputer = "."
Set objWMIService = GetObject_
("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & _
strComputer & "\root\cimv2")
Set colOperating Systems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Win32Shutdown(SHUTDOWN)
Next
'END Copy above this line
> by the way, I have learned from the manufacturer of the NDAS drive that I
> will want to execute the program ndascmd.exe with options. I know how I would
> do this in a DOS batch file how would I invoke this in this vbs script file?
Here is an example that runs notepad. I assume that it would be
similar for ndascmd.exe - though I haven't used it.
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "notepad.exe c:\scripts\test.txt"
> Thanks.
>
<<snip>>
Here is a great resource for scripting.
http://www.microsoft.com/technet/scriptcenter/resources/qanda/default.mspx
You may want to download the scripting archive with loads of examples
and explanations.
http://www.microsoft.com/downloads/...da-923a-4744-8289-afb73f6a5ed8&displaylang=en
I'll help where I can.
Good luck,
-solon fox