4 sonuçtan 1 ile 4 arası

Konu: iis açma kapama

  1. #1

    Standart iis açma kapama

    vbscript ile iis yi açıp kapatmak istiyoruz. bunu nasıl yapabiliriz acaba
     

  2. #2
    Yeni Üye
    Üyelik tarihi
    Jun 2006
    Mesajlar
    65

    Standart Ynt: iis açma kapama

    Option Explicit

    ' define ADSI status constants
    Const ADS_SERVICE_STOPPED = 1
    Const ADS_SERVICE_START_PENDING = 2
    Const ADS_SERVICE_STOP_PENDING = 3
    Const ADS_SERVICE_RUNNING = 4
    Const ADS_SERVICE_CONTINUE_PENDING = 5
    Const ADS_SERVICE_PAUSE_PENDING = 6
    Const ADS_SERVICE_PAUSED = 7
    Const ADS_SERVICE_ERROR = 8

    ' define string constants for service methods
    Const START_SERVICE = "START"
    Const STOP_SERVICE = "STOP"
    Const PAUSE_SERVICE = "PAUSE"
    Const CONTINUE_SERVICE = "CONTINUE"

    ' declare global variables
    Dim objWsh
    Dim objEnv
    Dim strComputerName

    ' get the environment variable with the computer name
    Set objWsh = WScript.CreateObject("WScript.Shell&quot
    Set objEnv = objWsh.Environment("PROCESS&quot
    strComputerName = objEnv("COMPUTERNAME&quot

    ' call CycleService() to stop all the services
    CycleService strComputerName,"MSFTPSVC",STOP_SERVICE, True
    CycleService strComputerName,"SMTPSVC" ,STOP_SERVICE,True
    CycleService strComputerName,"NNTPSVC" ,STOP_SERVICE,True
    CycleService strComputerName,"W3SVC" ,STOP_SERVICE,True
    CycleService strComputerName,"IISADMIN",STOP_SERVICE, True

    ' call CycleService() to start all the services
    CycleService strComputerName,"IISADMIN",START_SERVICE ,True
    CycleService strComputerName,"W3SVC" ,START_SERVICE,True
    CycleService strComputerName,"NNTPSVC" ,START_SERVICE,True
    CycleService strComputerName,"SMTPSVC" ,START_SERVICE,True
    CycleService strComputerName,"MSFTPSVC",START_SERVICE ,True

    ' ****************************************
    ' CycleService() subroutine
    ' this subroutine is passed four variables:
    ' 1. strComputer = the name of the computer
    ' 2. strService = the name of the service (e.g. w3svc, smtpsvc, etc.)
    ' 3. strOperation = the operation to be completed (e.g. start, stop)
    ' 4. boolTrace = True will output trace information, False will not
    ' ****************************************
    Sub CycleService(strComputer,strService,strOperation,b oolTrace)
    On Error Resume Next

    ' declare variables
    Dim objComputer
    Dim objService
    Dim strTrace
    Dim boolSuccess

    ' get ADSI objects and initial variables
    Set objComputer = GetObject("WinNT://" & strComputer & ",computer&quot
    Set objService = objComputer.GetObject("Service",strServi ce)
    strTrace = strOperation & " " & strService & " on " & strComputer
    boolSuccess = False

    ' output trace information if needed
    If boolTrace Then Trace "Attempting to " & strTrace & "..."

    ' determine the operation and carry it out
    Select Case (strOperation)
    Case START_SERVICE
    If (objService.Status = ADS_SERVICE_STOPPED) Then
    objService.Start
    If Err.Number<>0 Then ErrorHandler strTrace
    While objService.Status <> ADS_SERVICE_RUNNING: Wend
    boolSuccess = True
    End If
    Case STOP_SERVICE
    If (objService.Status = ADS_SERVICE_RUNNING) Or (objService.Status = ADS_SERVICE_PAUSED) Then
    objService.Stop
    If Err.Number<>0 Then ErrorHandler strTrace
    While objService.Status <> ADS_SERVICE_STOPPED: Wend
    boolSuccess = True
    End If
    Case PAUSE_SERVICE
    If (objService.Status = ADS_SERVICE_RUNNING) Then
    objService.Pause
    If Err.Number<>0 Then ErrorHandler strTrace
    While objService.Status <> ADS_SERVICE_PAUSED: Wend
    boolSuccess = True
    End If
    Case CONTINUE_SERVICE
    If (objService.Status = ADS_SERVICE_PAUSED) Then
    objService.Continue
    If Err.Number<>0 Then ErrorHandler strTrace
    While objService.Status <> ADS_SERVICE_RUNNING: Wend
    boolSuccess = True
    End If
    End Select

    ' output trace information if needed
    If boolTrace And boolSuccess Then Trace strTrace & " was successful."

    End Sub

    ' ****************************************
    ' Trace() subroutine
    ' outputs time and trace information
    ' ****************************************
    Sub Trace(strText)
    WScript.Echo Now & " : " & strText
    End Sub

    ' ****************************************
    ' ErrorHandler() subroutine
    ' outputs error status and exits
    ' ****************************************
    Sub ErrorHandler(strText)

    Dim strError
    strError = Now & " : The following error occurred trying to " & strText & vbCrLf
    strError = strError & vbCrLf & "0x" & Hex(Err.Number) & " - " & Err.Description
    WScript.Echo strError
    WScript.Quit

    End Sub
    prompt a

    CSCRIPT VBSDOSYASI.VBS

    kullanarak tüm iis servislerini restart edebilrisin .


    eğer pool recycle etmek istiyorsan system folder ı altında iisapp.vbs diye bir dosya olması gerekiyor. onunla yapabilirsin.
    I am at a deep level as you cannot imagine;sniffing your frames..Injecting the rules of my entity...

  3. #3

    Standart Ynt: iis açma kapama

    verdiğiniz kodları çalıştıramadım. hata veriyor. ne olabilir acaba. birde sınıflara php için wamp kurduk. php dersi olduğu zaman wampı asp dersi olduğu zaman iis yi nasıl çalıştırabiliriz acaba
     

  4. #4

    Standart

    iis açma kapama ile ilgili birden fazla yöntem var. bunları burada öğrenebilirsiniz

    IIS Yönetim Paneline mmc Konsolu İle Ulaşma | Uzaktan Eğitim
     

Yetkileriniz

  • Konu Açma Yetkiniz Yok
  • Cevap Yazma Yetkiniz Yok
  • Eklenti Yükleme Yetkiniz Yok
  • Mesajınızı Değiştirme Yetkiniz Yok
  •  
Hakkımızda
MSHOWTO, herhangi bir firma ya da kuruluş ile bağı olmayan bağımsız teknik bir topluluktur.
Sosyal Medya Linklerimiz