Welcome to Sign in | Help

Re: wmi help plsz

  •  08-28-2007, 10:04 AM

    Re: wmi help plsz

    Cea mai simpla solutie este un script VBS care schimba modul de start a serviciului dupa care restarteaza calculatorul (stiu, e o solutie care consuma timpul):

     'Dezactivare/activare cdrom
    computer     = "."    
    serviciu    = "cdrom"        
    modstart    = "Disabled"    ' Disabled=dezactivare sau Automatic=activare    

    Set oInstance     = GetObject("winmgmts:{impersonationLevel=impersonate}//" & computer & _
        "/root/cimv2:Win32_Service=" & Chr(34) & serviciu & Chr(34))

    rez         = oInstance.ChangeStartMode(modstart)
    text        = "OK"
    If rez <> 0 Then text = "esec"
    WScript.Echo "Rezultat ChangeStartMode: " & text

    WScript.Echo "URMEAZA RESTART !"

    'Restart
    forteazarestart    = 6
    Set oOS = GetObject("winmgmts:{(Shutdown)}").ExecQuery("Select * from Win32_OperatingSystem")
    For Each oOperatingSystem in oOS
        oOperatingSystem.Win32Shutdown(forteazarestart)
    Next


     

View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems