Check the disk space of a remote computer





1
Date Submitted Mon. Aug. 31st, 2009 11:45 PM
Revision 1 of 1
Scripter Cloudgen
Tags diskspace | remote-computer | wsf
Comments 0 comments
This wsf code can be used to check the disk space of a remote computer by supplying the login name and password, detailed discussion can be found in: disk space of remote computer

<?xml version="1.0"?>
<package>
<job>
<script language="vbscript">
<![CDATA[
  syntax = false
  If WScript.arguments.count = 3 Then
    strComputer = WScript.arguments(0)
    strUser = WScript.arguments(1)
    strPass = WScript.arguments(2)
    syntax = True
  ElseIf WScript.arguments.count = 1 Then
    strComputer = WScript.arguments(0)
    WScript.StdOut.write "User name:"
    strUser = WScript.StdIn.ReadLine
    WScript.StdOut.write "Password:"
    strPass = WScript.StdIn.ReadLine
    syntax = True
  ElseIf WScript.arguments.count = 0 Then
    WScript.StdOut.Write "Computer Name or IP:"
    strComputer = WScript.StdIn.ReadLine
    WScript.StdOut.write "User name:"
    strUser = WScript.StdIn.ReadLine
    WScript.StdOut.write "Password:"
    strPass = WScript.StdIn.ReadLine
    syntax = True
  End If
  If syntax Then
    Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
    Set objWMIService = objWbemLocator.ConnectServer(strComputer, "root\cimv2",strUser,strPass)
    Set colOSName = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where DeviceID = 'C:'")
    For Each objItem in colOSName
      WScript.Echo strComputer & ": " & objItem.Caption
    Next
  Else
    WScript.Echo "diskspace.wsf [ip] [user] [password]"
  End If
]]>
</script>
</job>
</package>
 

Comments

There are currently no comments for this snippet.

Voting

Votes Up


Scripter Cloudgen

Votes Down