자유게시판

dd

페이지 정보

작성자 슈퍼아이피 (180.♡.180.9) 댓글 0건 조회 2,468회 작성일 11-11-17 16:07

본문

Set WshNetwork = WScript.CreateObject("WScript.Network")
 ComputerName = WshNetwork.ComputerName
Set WshNetwork = Nothing
 
Set oWMI = getObject("winmgmts://")
Set WshShell = WScript.CreateObject("WScript.Shell")

'********************************************
'파일 검증 헤더
'********************************************

'namefile= "D:\Profile\jinhan2\내 문서\001.문서모음\013. 대외\도로공사\교통센터\201111프로세스조사\" & ComputerName & ".txt" 
namefile= "C:\" & ComputerName & "_PROCESS.LOG" 
namefile1= "C:\" & ComputerName & "_SERVICE.LOG" 
Set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.OpenTextFile(namefile, 8, true)

 

'===============================================
'날짜, 시간, 요일
'===============================================

today = Date()                                             '날짜
mytime = Time()                                        '시간
myday  =  Weekday(Now)                        '요일   1=일, 2=월, 3=화, 4=수, 5=목, 6=금, 7=토

'a.WriteLine("today: "&today)
'a.WriteLine("mytime: "&mytime)
'a.WriteLine("myday: "&myday)


'===============================================
'Win32_LocalTime  날짜, 시간, 요일   AMD서버 실행불가
'===============================================

'Set oTmp = oWMI.InstancesOf("Win32_LocalTime")
' For Each oCtrl in oTmp
'  sYear  = oCtrl.Year                                               
'  sMonth = oCtrl.Month                                      
'  sDay  = oCtrl.Day                         
'  sHour   = oCtrl.Hour                           
'  sMinute   = oCtrl.Minute                               
'  sDayOfWeek   = oCtrl.DayOfWeek                                 '일-0, 월-1 ~ 토-6

'  a.WriteLine("년: "&sYear)
'  a.WriteLine("월: "&sMonth)
'  a.WriteLine("일: "&sDay)
'  a.WriteLine("시: "&sHour)
''  a.WriteLine("분: "&sMinute)
'  a.WriteLine("요일: "&sDayOfWeek)

'  Next
'Set oTmp = nothing
  


'===============================================
'Win32_Process            '프로세스
'===============================================
a.WriteLine "프로세스이름,프로세스실행위치,프로세스생성날자,프로세서ID,프로세서우선순위,실제메모리,가상메모리,페이징풀,넌페이징풀"
Set oTmp = oWMI.InstancesOf("Win32_Process")
 For Each oCtrl in oTmp
     sDescription  = oCtrl.Description
  sExecutablePath = oCtrl.ExecutablePath
'  sCommandLine = oCtrl.CommandLine             '메일2서버 윈도우2000에서 지원되지 않음
  sCreationDate = oCtrl.CreationDate
  sProcessId = oCtrl.ProcessId
  sPriority  = oCtrl.Priority
  sPhyMemory = oCtrl.WorkingSetSize                                                      '실제메모리
     sPageFileUsage = oCtrl.PageFileUsage                             '페이징파일메모리
  sQuotaPagedPoolUsage = oCtrl.QuotaPagedPoolUsage   '페이징풀크기
     sQuotaNonPagedPoolUsage = oCtrl.QuotaNonPagedPoolUsage   '넌페이징풀크기

 
     a.WriteLine sDescription & ", " & sExecutablePath & ", " & sCreationDate & ", " & sProcessId & ", " & sPriority & ", " & sPhyMemory & ", " & sPageFileUsage & ", " & sQuotaPagedPoolUsage & ", " & sQuotaNonPagedPoolUsage

 Next
Set oTmp = nothing
a.Close

Set a = fso.OpenTextFile(namefile1, 8, true)
arrComputers = Array(".")
For Each strComputer In arrComputers
   WScript.Echo
'   WScript.Echo "=========================================="
'   WScript.Echo "Computer: " & strComputer
'   WScript.Echo "=========================================="
a.WriteLine " "
a.WriteLine("##############################################")
a.WriteLine("##########   서비스 리스트   #################")
a.WriteLine("##############################################")
a.WriteLine " "

   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
   Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Service", "WQL", _
                                          wbemFlagReturnImmediately + wbemFlagForwardOnly)
   a.WriteLine "서비스이름,서비스경로,서비스상태,서비스설명"
  
   For Each objItem In colItems
      'wscript.echo objItem.DisplayName & ", " & objItem.PathName & ", " & objItem.State & ", " & trim(objItem.Description) &vbCrLf
     
      if isNULL(objItem.Description)  then
        objItem.Description = "설명없음"
        'wscript.echo objItem.Description
      end if
      a.WriteLine objItem.DisplayName & ", " & objItem.PathName & ", " & objItem.State & ", " & objItem.Description
   Next
  
   Set colItems=nothing
   Set objWMIService=nothing
Next

 

'********************************************
'파일 종료
'********************************************

a.Close
Set  a = Nothing

 


 

추천0 비추천0

댓글목록

등록된 댓글이 없습니다.

Copyright 2019 © superip.net