Error running script on Windows 2008

Author Message
CoquitoKing

  • Total Posts : 25
  • Scores: 0
  • Reward points : 0
  • Joined: 4/20/2005
  • Location: USA
  • Status: offline
Error running script on Windows 2008 Tuesday, December 13, 2011 4:26 AM (permalink)
0
[Helpful answer received] / [List Solutions Only]
Hi Guys,
 
I get the following error:
Script:  c:\diskUsage.vbs
Line:  15
Char:  1
Error:  The remote server machine does not exist or is unavailable: 'GetObject'
Code:  800A01CE
Source:  Microsoft VBScript runtime error
 
 -- when trying to run this script on a Windows Server 2008:
 
Input = InputBox("Please enter machine name:","Machine Name")
strComputer = Input
' const strComputer = "."
' const strReport = "c:\diskspace.txt"
strReport = "C:\" & Input & ".txt"

Dim objWMIService, objItem, colItems
Dim strDriveType, strDiskSize, txt
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk WHERE DriveType=3")
txt = "Drive" & vbtab & "Size" & vbtab & "Used" & vbtab & "Free" & vbtab & "Free(%)" & vbcrlf
For Each objItem in colItems
 
 DIM pctFreeSpace,strFreeSpace,strusedSpace
 
 pctFreeSpace = INT((objItem.FreeSpace / objItem.Size) * 1000)/10
 strDiskSize = Int(objItem.Size /1073741824) & "Gb"
 strFreeSpace = Int(objItem.FreeSpace /1073741824) & "Gb"
 strUsedSpace = Int((objItem.Size-objItem.FreeSpace)/1073741824) & "Gb"
 txt = txt & objItem.Name & vbtab & strDiskSize & vbtab & strUsedSpace & vbTab & strFreeSpace & vbtab & pctFreeSpace & vbcrlf
Next
writeTextFile txt, strReport
wscript.echo "Report written to " & strReport & vbcrlf & vbcrlf & txt
' Procedure to write output to a text file
private sub writeTextFile(byval txt,byval strTextFilePath)
 Dim objFSO,objTextFile
 
 set objFSO = createobject("Scripting.FileSystemObject")
 set objTextFile = objFSO.CreateTextFile(strTextFilePath)
 objTextFile.Write(txt)
 objTextFile.Close
 SET objTextFile = nothing
end sub
 
Works flawlessly on all my 2003 machines.  Any help will be greatly appreciated.
 
C
 
#1
    59cobalt

    • Total Posts : 969
    • Scores: 91
    • Reward points : 0
    • Joined: 7/17/2011
    • Status: offline
    Re:Error running script on Windows 2008 Tuesday, December 13, 2011 7:48 AM (permalink)
    0
    [This post was marked as helpful]
    CoquitoKing
    I get the following error:
    Script:  c:\diskUsage.vbs
    Line:  15
    Char:  1
    Error:  The remote server machine does not exist or is unavailable: 'GetObject'
    Code:  800A01CE
    Source:  Microsoft VBScript runtime error

    -- when trying to run this script on a Windows Server 2008:
    Disable the firewall.
     
    #2
      CoquitoKing

      • Total Posts : 25
      • Scores: 0
      • Reward points : 0
      • Joined: 4/20/2005
      • Location: USA
      • Status: offline
      Re:Error running script on Windows 2008 Tuesday, December 13, 2011 8:27 AM (permalink)
      0
      59cobalt


      CoquitoKing
      I get the following error:
      Script:  c:\diskUsage.vbs
      Line:  15
      Char:  1
      Error:  The remote server machine does not exist or is unavailable: 'GetObject'
      Code:  800A01CE
      Source:  Microsoft VBScript runtime error

      -- when trying to run this script on a Windows Server 2008:
      Disable the firewall.
       
      I just checked and disabled the firewall.  All is working ok now.   
       
      Thanks again 59cobalt
       
       
      <message edited by CoquitoKing on Tuesday, December 13, 2011 8:31 AM>
       
      #3
        ebgreen

        • Total Posts : 8227
        • Scores: 98
        • Reward points : 0
        • Joined: 7/12/2005
        • Status: online
        Re:Error running script on Windows 2008 Tuesday, December 13, 2011 8:31 AM (permalink)
        0
        Firewall was my first guess also. If they are in different domains without cross domain trust that would be an issue as well. Check the event logs.
        "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
        Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
        http://www.visualbasicscript.com/m_47117/tm.htm
         
        #4

          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2012 ASPPlayground.NET Forum Version 3.9