Afsluit script

Status
Niet open voor verdere reacties.

rscheerhout

Gebruiker
Lid geworden
4 okt 2000
Berichten
136
Hallo Daar,

Ik zit met een probleem...:evil:

Op mijn werk hebben we een probleem met roaming profiles van Windows 2000. Bij het afsluiten van de workstations zorgt de Virusscanner (symantec corp. 9.0) ervoor dat er een lock ontstaat op files of registersleutels hierdoor kan windows de profielen niet unloaden.
Om dit probleem op te lossen heb ik een VBS script gemaakt die eerst de virusscanner uitschakelt. En dan pas het OS. Zodat de profiles naar het netwerk gezet kunnen worden.

Opzicht is dit een oplossing, maar nu willen we een keuze menu maken met een 3 tal opties:

Afmelden
Opnieuw Opstarten
Afsluiten

Nu is mijn vraag:

Is het mogelijk om een keuze menu te maken in VBS. Of heeft iemand een andere oplossing voor het keuze menu. :confused:


Voorbeeld bestaande script.
********************************************

' Pinkroccade. This script is made by: Robert Scheerhout
'***************************************************************************
'
' WMI Sample Script - Stops a service (VBScript)
'
' This script demonstrates how to stop a specific service from instances of
' Win32_Service.
'
' NOTE: This script only applies to NT-based systems since Win9x does support services
'
'
'***************************************************************************
Set ServiceSet = GetObject("winmgmts:").ExecQuery("select * from Win32_Service where Name='Symantec Antivirus'")

for each Service in ServiceSet
RetVal = Service.StopService()
if RetVal = 0 then
WScript.Echo "Norton Antivirus Service stopped i.v.m Profiel unload"
elseif RetVal = 5 then
WScript.Echo "Norton Antivirus Service already stopped"
end if

WScript.Sleep 3000

next

'***************************************************************************
'
' WMI Script - System shutdown (VBScript)
'
' Invokes the Win32Shutdown method of the Win32_OperatingSystem class.
' Supports logoff, reboot, shutdown/poweroff, and forcing the system to ignore
' any dialogs that pop up.
'
' NOTE: You must have the Shutdown privilege to successfully invoke the Shutdown method
'
'***************************************************************************
Dim ArgObj
Dim OpSysSet
Dim OpSys
Dim ShutdownFlags
Dim Reserved
Dim i

'
' Basic flags for Win32_OperatingSystem.Win32Shutdown()
'
const WMI_LOGOFF = &H0
const WMI_SHUTDOWN = &H1
const WMI_REBOOT = &H2
const WMI_POWEROFF = &H8

'
' This flag can be added to any of the above to force the action (ignoring dialogs/prompts)
'
const WMI_FORCE = &H4

const LOGOFF = "logoff"
const SHUTDOWN = "shutdown"
const REBOOT = "reboot"
const POWEROFF = "poweroff"
const FORCE = "force"

Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")

ShutdownFlags = 8
Reserved = 0

' Get the Arguments object
set ArgObj = WScript.Arguments

'if ArgObj.Count = 0 Then
'WScript.Echo "Usage: cscript shutdown.vbs [[force]logoff|shutdown|reboot|poweroff]"

'end If

for i = 0 to ArgObj.Count - 1

if (StrComp(ArgObj.Item(i), LOGOFF, vbTextCompare) = 0) then
ShutdownFlags = ShutdownFlags Or WMI_LOGOFF
WScript.Echo "Logoff"
elseif (StrComp(ArgObj.Item(i), SHUTDOWN, vbTextCompare) = 0) then
ShutdownFlags = ShutdownFlags Or WMI_SHUTDOWN
WScript.Echo "Shutdown"
elseif (StrComp(ArgObj.Item(i), REBOOT, vbTextCompare) = 0) then
ShutdownFlags = ShutdownFlags Or WMI_REBOOT
WScript.Echo "Reboot"
elseif (StrComp(ArgObj.Item(i), POWEROFF, vbTextCompare) = 0) then
ShutdownFlags = ShutdownFlags Or WMI_POWEROFF
WScript.Echo "Power Off"
elseif (StrComp(ArgObj.Item(i), FORCE, vbTextCompare) = 0) then
ShutdownFlags = ShutdownFlags Or WMI_FORCE
WScript.Echo "Force"
else
WScript.Echo "Invalid parameter '" & ArgObj.Item(i) & "' specified"
end if

next

for each OpSys in OpSysSet
call OpSys.Win32Shutdown(ShutdownFlags, Reserved)
Next
 
Laatst bewerkt:
Dit soort problemen zou ik niet met scripting proberen op te lossen. Dat is een probleem waar gegarandeerd meerdere mensen last van hebben. Hieronder wat tips vanuit een kort google zoektochtje...

I found a solution for my problem. I edited with Microsoft Management
Console the Local Computer Policy "Maximum retries to unload and update user
profile" to 0. Now Windows shuts down and logs of immediately and no event
error is written.

Nog een resultaat met flink wat links met mogelijke oplossingen:

http://groups.google.nl/groups?hl=n...UTF-8&q=symantec+roaming+profile+windows+2000


Grtz,
 
Citrix MetaFrame

Hallo Mark,

Ik heb je links even bekeken.. Maar dit gaat over een Citrix MetaFrame omgeving. Wij draaien geen Citrix MetaFrame omgeving. Dus de solutions gaan niet echt op voor ons. Ik heb dit ook al besproken met Symantec en zei denken dat het ook niet voor ons geldt.

Ieder geval bedankt voor je reactie...


:D
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan