Hi,
Can someone please give me tips to change my script from rsh (win2003) to PowerShell!!!?
Function 1:
'############################################################################################
' GetNetAppQuota()
' Ermittelt die insgesamt vergebene Quota (in MB) auf einem NetApp-Server Volume
'############################################################################################
Private Function GetNetAppQuota(lstrServer, lstrVolume)
On Error Resume Next
GetNetAppQuota = 0
Dim lWshShell, loExec
Dim lstrLine, lsz1
Dim lnQuota
If bDebug Then Call Logging("GetNetAppQuota().Param: " & lstrServer &", "& lstrVolume)
set lWshShell = CreateObject("WScript.Shell")
lsz1 = ""
Set loExec = lWshShell.Exec (Join(Array("rsh", lstrServer, "-n", "quota report")))
Do While Not loExec.StdOut.AtEndOfStream
lstrLine = MyTrimSpaces(replace(loExec.StdOut.ReadLine, vbCr, ""))
'wscript.echo lstrLine
lsz1 = split(lstrLine, " ")
if lsz1(0) <> "K-Bytes" And lsz1(0) <> "Type" And lsz1(0) <> "-----" And lsz1(1) <> "*" then
if lsz1(2) = lstrVolume then lnQuota = lnQuota + lsz1(5) / 1024
end if
Loop
GetNetAppQuota = lnQuota
If bDebug Then Call Logging("GetNetAppQuota().Return: " & GetNetAppQuota)
End Function
################################################
Function 2:
'############################################################################################
Private Function ExecRsh (host, cmd)
On Error Resume Next
Dim WshShell
If bDebug Then Call Logging("ExecRsh().Param: " & host & ", " & cmd)
Set WshShell = CreateObject("WScript.Shell")
if bDebug then Call Logging("ExecRsh().exec: " & Join(Array("rsh", host, "-n", cmd)))
Set ExecRsh = WshShell.Exec (Join(Array("rsh", host, "-n", cmd)))
Set WshShell = Nothing
If bDebug Then Call Logging("ExecRsh().Return: " & ExecRsh)
End Function
#######################################################
Thanks
Jalal_