알쓸신잡 Powershell 스크립트 모음4
[Explanation]
#팝업 메시지에 대한 설정$wshell = New-Object -ComObject Wscript.Shell
$wshell.Popup("Operation Completed",0,"Done",0x1)
https://msdn.microsoft.com/en-us/library/x83z1d9f%28v=vs.84%29.aspx?f=255&MSPPError=-2147217396
#MSTSC(원격데스트톱 연결) 정상 동작 확인If (New-Object System.Net.Sockets.TCPClient -ArgumentList 'twnhq10-dc14.domain.net',3389) { Write-Host 'RDP is ok!' }
#상위 값을 True or False로 반환If ($? -eq $false) { Write-Host 'Check!' }
#상위 조건 모두 넣은경우. RDP 정상 동작 확인If (New-Object System.Net.Sockets.TCPClient -ArgumentList 'twnhq10-dc14.domain.net',3389) { Write-Host 'RDP is ok!' }If ($? -eq $false) { Write-Host 'Check!' }
#서버 Hang 상태 확인 & Event Logging 가능
$server=New-Object System.Collections.ArrayList
$server=Get-Content C:\Users\administrator\Desktop\server.txt
$count=$server.count-1
$confirm_3389=$null
$confirm_3400=$null
for($n=0 ; $n -le $count; $n++){
$server[$n]
$confirm_3389=(New-Object System.Net.Sockets.TCPClient -ArgumentList $server[$n] ,3389)
if($? -eq $true){
Write-Output "It's Ok with port 3389"
}else{
$confirm_3400=(New-Object System.Net.Sockets.TCPClient -ArgumentList $server[$n] ,3400)
if($? -eq $true){
Write-Output "It's Ok with port 3400"
}else{
$server=$server[$n]
Write-EventLog -LogName system -Source "EventLog" -EventID 8282 -Message "Check the status of server : $server "
}
}
}
댓글이나 의견은 언제든지 환영합니다.
Your Comments are Always Welcomed!
0 comments:
Post a Comment