search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Windows Powershell | No Comment | 1,553 views | 10/09/2009 22:30

Aşağıdaki Powershell scripti ile bir veritabanından çektirdiğiniz ip adresleri ile sunucu isimlerini, Argus yazılımının config dosyasına uygun hale getirebilirsiniz.

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
Add-PSSnapin -name Microsoft.SystemCenter.VirtualMachineManager
Get-Vmmserver localhost
$VMProp = Get-VM | Select-Object -Property Name,OperatingSystem
Foreach ($i in $VMProp)
{
$VMName = $i.Name
$gateway = ($prefix.split("/")[0])
$netid = [System.Net.IPAddress]("$gateway");
$bits = $netid.GetAddressBytes()
$ip1=$bits[0]
$ip2=$bits[1]
$ip3=$bits[2]
$ip5=$bits[3]+2
$strIpAddress = "$ip1.$ip2.$ip3.$ip5"
$valuebir = '        Host "' + $VMName + '" {'
$valueiki = '                hostname: ' + $strIpAddress
$valueikibucuk = '                Service Ping'
$valueuc = '                Service TCP/HTTP'
$valuedort = '        }'
add-content -path “C:\argus.txt” -value $valuebir
add-content -path “C:\argus.txt” -value $Valueiki
add-content -path “C:\argus.txt” -value $Valueikibucuk
add-content -path “C:\argus.txt” -value $valueuc
add-content -path “C:\argus.txt” -value $valuedort
}

Powershell üzerinden nasıl SQL bağlantısı yapılabileceğini site üzerinde arama yaparak bulabilirsiniz.