달력

5

« 2024/5 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
2009. 6. 29. 17:49

오래된 파일 삭제 VBS (VB Script) Etc.2009. 6. 29. 17:49

strFolder = "C:\TEMP"
strExtensionUp = "TXT"
strExtensionLo = "txt"
DateDiffer = -30

Set dateTime = CreateObject("WbemScripting.SWbemDateTime")

Dim strFileName(), strFileCre(), Differ(), DelList()
strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")

For Each objItem in colItems
dateTime.Value = objItem.LocalDateTime
strToday = dateTime.GetVarDate
Next

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colFileList = objWMIService.ExecQuery _
    ("ASSOCIATORS OF {Win32_Directory.Name='" & strFolder & "'} Where " _
        & "ResultClass = CIM_DataFile")

ReDim Preserve strFileName(colFileList.count), strFileCre(colFileList.count), Differ(colFileList.count), DelList(colFileList.count)

n = 0
d = 0
For Each objFile In colFileList
If objFile.Extension = strExtensionUp or objFile.Extension = strExtensionLo Then
strFileName(n) = objFile.Name
dateTime.Value = objFile.CreationDate
strFileCre(n) = dateTime.GetVarDate
Differ(n) = DateDiff ("D", strToday, strFileCre(n))
If Differ(n) < DateDiffer Then
DelList(d) = strFileName(n)
d = d + 1
End If
n = n + 1
End If
Next

strMessage = DateDiffer & "일 보다 오래된 다음 백업 파일들을 삭제합니다." & vbCrLf & vbCrLf
For i = 0 to d
strMessage = strMessage & DelList(i) & vbCrLf
Next

If d = 0 Then WScript.Quit

set objWSHShell = Wscript.CreateObject("Wscript.Shell")
WriteEvent = objWSHShell.LogEvent(4, strMessage, strComputer)

For i = 0 to d-1
strFilePath = DelList(i)
reFile = Replace(strFilePath,"\","\\")
set objFile = GetObject("winmgmts:\\"& strComputer & "\root\cimv2:CIM_Datafile.Name='" & reFile & "'")
objFile.Delete
Next

:
Posted by 커널64
2009. 6. 22. 16:30

서버 이름 쿼리 VBS Etc.2009. 6. 22. 16:30

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objItem In colItems
WScript.Echo "ServerName: " & objItem.CSName
Next
Set colItems = NOTHING
:
Posted by 커널64
2009. 6. 22. 16:28

원격 포트 접속 확인 VBS (Script) Etc.2009. 6. 22. 16:28

strMessage = ""

set shellobj=WScript.CreateObject("WScript.Shell")

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile (".\RUNNETSTAT.BAT", 8, True)

objTextFile.WriteLine("netstat -an | findstr " & Chr(34) & "168.126.63.1:53" & Chr(34) & " | findstr " & Chr(34) & "EST" & Chr(34))
objTextFile.Close
set objTextFile = nothing

set execObj=shellobj.Exec(".\RUNNETSTAT.BAT")
OutData=execObj.StdOut.ReadAll()
val=execObj.StdOut.Line - 3

Set aFile = objFSO.GetFile(".\RUNNETSTAT.BAT")
aFile.Delete
Set aFile = nothing

If val = 0 Then
strMsg = MsgBox("Port Error!!",16,"Caution")
End If

set OutData = nothing
set execObj = nothing
set shellobj = nothing

:
Posted by 커널64
HP ProLiant 서버에 Windows Server 2008 설치 시 블루스크린 발생

블루스크린에 나타나는 메시지는 BUGCODE_USB_DRIVER이며 증상 발생은 불규칙한 것 같다.
Windows Server 2008 모든 버전에서 발생하며 SP2가 포함되었건 R2건 상관없이 발생한다.
원인은 USB 포트가 Sleep 모드로 들어가면서 발생한다고 하는데 뭐... 어쨋든 해결책은...

iLO 2 Firmware를 버전 1.29 또는 그 이상으로 업데이트하면 된다.
이미 설치를 진행하던 중에 발생했다면 다른 운영체제를 설치하고 업데이트하면 되겠다.
:
Posted by 커널64
2009. 6. 13. 09:47

Windows Server 2008 R2 특징 정리 (MS 문서 정리) Etc.2009. 6. 13. 09:47

     x64 버전으로만 출시되는 첫번째 Windows 서버 플랫폼

     최대 256개의 논리적인 프로세서 지원

     SLAT(Second Level Address Translation) 지원

     SLAT = 가상화에 대한 지원으로 기존에는 Guest 운영체제에서 메모리를 실제 메모리에 맵핑할 때 CPU가 한 번의 메모리 주소 변환만을 수행할 수 있었기 때문에 Hypervisor Guest 운영체제가 사용하는 실제 메모리로 맵핑하는 업무를 담당해 Hypervisor에 메모리와 CPU에 대한 Overhead가 있었으나 이제는 이러한 두 번의 메모리 변환을 수행할 수 있는 기능을 CPU에서 지원(Intel: EPT(Extended Page Tables), AMD: NPT(Nested Page Tables) / RVI(Rapid Virtualization Indexing)하게 되었으며 이 기능을 운영체제 레벨에서 사용할 수 있게 됨

     Hyper-V가 호스트 CPU에 대해 최대 64개의 논리적인 CPU를 지원

     프로세서의 사용량에 따라 프로세서의 성능 조절을 통해 전원을 효율적으로 사용하며 이에 대한 설정을 그룹 정책을 통해 Windows Server 2008 Windows 7에 적용 가능

     Hyper-V에 대한 업데이트. (Live Migration 지원, SLAT 지원, 64개의 논리적인 프로세서 지원, Hot Add/Remove Storage(VHD))

     터미널 서비스의 기능을 확장한 Virtual Desktop Integration (VDI) 기능 포함. (터미널 서비스를 이용한 데스크탑 가상화(일반적인 응용 프로그램과 동일한 사용자 경험), 그래픽/오디오에 대한 클라이언트 자원 이용, 웹 페이지를 통한 Presentation 가상화(Remote App))

     원격 관리에 대한 향상된 지원. (원격 설치가 가능한 서버 관리자(Server Manager), 향상된 AD DS/AD FS 관리 도구)

     240개의 새로운 명령어 세트를 포함하는 PowerShell 2.0 포함 (디버깅 및 테스트를 위한 Cmdlet 포함)

     외부에서 사내 망에 접근하기 위해 VPN과 같은 복잡한 설정없이 손쉽게 사내 망에 연결할 수 있도록 해주는 DirectAccess 기능

     BranchCache라는 기술을 통해 지사 간(WAN 구간) 데이터 전송에 대한 네트워크 사용량을 줄여준다. 지사의 규모에 따라 일종의 Cache 역할을 하는 BranchCache 서버를 두거나 Windows 7 컴퓨터로도 구성이 가능하다. BranchCache은 이용해 이전에 요청했던 파일을 로컬에 위치하는 BranchCache 서버에 저장해 두었다가 재 요청이 있는 경우 로컬 Cache 서버에서 전송하게 해 WAN 구간의 네트워크 사용량을 줄이고 사용자는 빠르게 데이터에 접근할 수 있게 해 준다.

     SMB 시장을 위한 Small Business Server, Windows Essential Business Server에는 여러 관리 콘솔을 한 곳에서 관리할 수 있도록 하는 PowerShell에 기반한 통합된 관리 콘솔을 제공한다. 예를 들면 Active Directory Administration Center가 있겠다.

     Windows Server 2008 R2에는 IIS 7.5가 포함된다. IIS의 효율적인 관리를 위한 IIS PowerShell Provider, 서버 코어 버전에 .NET Framework가 포함되며 문제 해결을 위한 Configuration logging 기능과 전용 BPA(Best Practice Analyzer)가 제공되며 URLScan 3.0(Request Filter Module)도 통합된다.

     지속적으로 증가하고 있는 데이터 저장소의 효율적인 관리를 위해 File Classification Infrastructure(FCI) 기능을 제공한다. FCI는 파일 공유에 기반한 확장가능하고 자동화된 파일 분류 기능이다. 관리자는 특정 파일에 대한 분류를 이용해 특정한 작업을 취할 수 있게 된다. 또한, FCI는 파트너가 확장할 수 있도록 해 ISV들에 의해 FCI를 이용한 여러 응용 프로그램이 개발될 수 있다.


:
Posted by 커널64
2009. 5. 28. 17:03

Windows Server 2008에 WebDAV 설치 Etc.2009. 5. 28. 17:03

:
Posted by 커널64
2009. 4. 7. 08:39

Volume GUID 확인 VB Script Etc.2009. 4. 7. 08:39

GetVolumeGUID.vbs


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_Volume")

For Each objItem In colItems
    WScript.Echo "Automount: " & objItem.Automount
    WScript.Echo "Block Size: " & objItem.BlockSize
    WScript.Echo "Capacity: " & objItem.Capacity
    WScript.Echo "Caption: " & objItem.Caption
    WScript.Echo "Compressed: " & objItem.Compressed
    WScript.Echo "Device ID: " & objItem.DeviceID
    WScript.Echo "Dirty Bit Set: " & objItem.DirtyBitSet
    WScript.Echo "Drive Letter: " & objItem.DriveLetter
    WScript.Echo "Drive Type: " & objItem.DriveType
    WScript.Echo "File System: " & objItem.FileSystem
    WScript.Echo "Free Space: " & objItem.FreeSpace
    WScript.Echo "Indexing Enabled: " & objItem.IndexingEnabled
    WScript.Echo "Label: " & objItem.Label
    WScript.Echo "Maximum File Name Length: " & objItem.MaximumFileNameLength
    WScript.Echo "Name: " & objItem.Name
    WScript.Echo "Quotas Enabled: " & objItem.QuotasEnabled
    WScript.Echo "Quotas Incomplete: " & objItem.QuotasIncomplete
    WScript.Echo "Quotas Rebuilding: " & objItem.QuotasRebuilding
    WScript.Echo "Serial Number: " & objItem.SerialNumber
    WScript.Echo "Supports Disk Quotas: " & objItem.SupportsDiskQuotas
    WScript.Echo "Supports File-Based Compression: " & _
        objItem.SupportsFileBasedCompression
    WScript.Echo
Next

:
Posted by 커널64
2009. 3. 16. 14:31

SNMPUTIL.exe Etc.2009. 3. 16. 14:31


SNMPUTIL.exe
:
Posted by 커널64
2009. 2. 20. 16:19

레지스트리 관련 VB Script (vbs) Etc.2009. 2. 20. 16:19

Checking Registry Key Access Rights
const KEY_QUERY_VALUE = &H0001
const KEY_SET_VALUE = &H0002
const KEY_CREATE_SUB_KEY = &H0004
const DELETE = &H00010000
const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "SYSTEM\CurrentControlSet"

oReg.CheckAccess HKEY_LOCAL_MACHINE, strKeyPath, KEY_QUERY_VALUE, _
bHasAccessRight
If bHasAccessRight = True Then
StdOut.WriteLine "Have Query Value Access Rights on Key"
Else
StdOut.WriteLine "Do Not Have Query Value Access Rights on Key"
End If

oReg.CheckAccess HKEY_LOCAL_MACHINE, strKeyPath, KEY_SET_VALUE, _
bHasAccessRight
If bHasAccessRight = True Then
StdOut.WriteLine "Have Set Value Access Rights on Key"
Else
StdOut.WriteLine "Do Not Have Set Value Access Rights on Key"
End If

oReg.CheckAccess HKEY_LOCAL_MACHINE, strKeyPath, KEY_CREATE_SUB_KEY, _
bHasAccessRight
If bHasAccessRight = True Then
StdOut.WriteLine "Have Create SubKey Access Rights on Key"
Else
StdOut.WriteLine "Do Not Have Create SubKey Access Rights on Key"
End If

oReg.CheckAccess HKEY_LOCAL_MACHINE, strKeyPath, DELETE, bHasAccessRight
If bHasAccessRight = True Then
StdOut.WriteLine "Have Delete Access Rights on Key"
Else
StdOut.WriteLine "Do Not Have Delete Access Rights on Key"
End If

---------------------------------------------------------------------------------------------------------------

Reading a Binary Registry Value

const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
strValueName = "LicenseInfo"

oReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,_
strValueName,strValue
For i = lBound(strValue) to uBound(strValue)
 StdOut.WriteLine  strValue(i)
Next

---------------------------------------------------------------------------------------------------------------

Reading an Expanded String Value
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon"
strValueName = "UIHost"
oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,_
strValueName,strValue

StdOut.WriteLine  "The Windows logon UI host is: " & strValue

---------------------------------------------------------------------------------------------------------------

Reading a MultiString Value
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "SYSTEM\CurrentControlSet\Services\Eventlog\System"
strValueName = "Sources"

oReg.GetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,_
strValueName,arrValues
For Each strValue In arrValues
 StdOut.WriteLine  strValue
Next

---------------------------------------------------------------------------------------------------------------

Reading String and DWORD Values
const HKEY_CURRENT_USER = &H80000001
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "Console"
strValueName = "HistoryBufferSize"
oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
StdOut.WriteLine "Current History Buffer Size: " & dwValue

strKeyPath = "SOFTWARE\Microsoft\Windows Script Host\Settings"
strValueName = "TrustPolicy"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
StdOut.WriteLine "Current WSH Trust Policy Value: " & strValue

---------------------------------------------------------------------------------------------------------------

Creating Expanded String Values
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Key Name"
strValueName = "Expanded String Value Name"

strValue = "%PATHEXT%"
oReg.SetExpandedStringValue _
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

---------------------------------------------------------------------------------------------------------------

Creating a Registry Key
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Key Name"
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath

---------------------------------------------------------------------------------------------------------------

Creating String and DWORD Values
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Key Name"
strValueName = "String Value Name"
strValue = "string value"

oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

strValueName = "DWORD Value Name"
dwValue = 82

oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue

---------------------------------------------------------------------------------------------------------------

Deleting Registry Values
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Key Name"
strDWORDValueName = "DWORD Value Name"
strExpandedStringValueName = "Expanded String Value Name"
strMultiStringValueName = "Multi String Value Name"
strStringValueName = "String Value Name"

oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strDWORDValueName
oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strExpandedStringValueName
oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strMultiStringValueName
oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strStringValueName

---------------------------------------------------------------------------------------------------------------

Enumerating Registry Properties
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Registry")
For Each objItem in colItems
Wscript.Echo "Current Size: " & objItem.CurrentSize
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "Install Date: " & objItem.InstallDate
Wscript.Echo "Maximum Size: " & objItem.MaximumSize
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "Proposed Size: " & objItem.ProposedSize
Next

---------------------------------------------------------------------------------------------------------------

Enumerating Registry Values and Types
const HKEY_LOCAL_MACHINE = &H80000002
const REG_SZ = 1
const REG_EXPAND_SZ = 2
const REG_BINARY = 3
const REG_DWORD = 4
const REG_MULTI_SZ = 7
 
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "SYSTEM\Key Name"

oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath,_
arrValueNames, arrValueTypes

For i=0 To UBound(arrValueNames)
StdOut.WriteLine "Value Name: " & arrValueNames(i)
Select Case arrValueTypes(i)
 Case REG_SZ
  StdOut.WriteLine "Data Type: String"
  StdOut.WriteBlankLines(1)
 Case REG_EXPAND_SZ
  StdOut.WriteLine "Data Type: Expanded String"
  StdOut.WriteBlankLines(1)
 Case REG_BINARY
  StdOut.WriteLine "Data Type: Binary"
  StdOut.WriteBlankLines(1)
 Case REG_DWORD
  StdOut.WriteLine "Data Type: DWORD"
  StdOut.WriteBlankLines(1)
 Case REG_MULTI_SZ
  StdOut.WriteLine "Data Type: Multi String"
  StdOut.WriteBlankLines(1)
End Select
Next

:
Posted by 커널64
2009. 2. 5. 14:51

설치된 핫픽스(Hotfix) 목록 쿼리 - VBS Etc.2009. 2. 5. 14:51

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set QFES = objWMIService.execQuery("Select * from Win32_QuickFixEngineering")

For each QFE in QFES
 Wscript.Echo QFE.HotFixID
Next

:
Posted by 커널64