Why my VBS code book is so dumb! This code can't work properly!!

Author Message
lair360

  • Total Posts : 24
  • Scores: 0
  • Reward points : 0
  • Joined: 5/16/2008
  • Status: offline
Why my VBS code book is so dumb! This code can't work properly!! Tuesday, May 20, 2008 11:13 AM (permalink)
0
I've tried to fix this VBScript and it still give me errors!
Anything wrong here???
 
 strComputer = "."
 Set objWMIService = GetObject("winmgmts:" _
     & "{impersonationLevel=impersonate}!\\" & strComputer & _
         "\root\MicrosoftDNS")
 Set colItems = objWMIService.ExecQuery("Select * From MicrosoftDNS_Cache")
 For Each objItem in colItems
     objItem.ClearCache()
 Next
 

 
P.S. This script is very usefull and I need it alot! But, it doesn't bloody work!!
VBscript and computer educational website: http://globalnews.srcom.org/
 
#1
    lair360

    • Total Posts : 24
    • Scores: 0
    • Reward points : 0
    • Joined: 5/16/2008
    • Status: offline
    RE: Why my VBS code book is so dumb! This code can't work properly!! Tuesday, May 20, 2008 11:42 AM (permalink)
    0
    Microsoft is dumb as hell! This also goes to Xbox and their junk!!
    The code should be like this!!
      
     '---------------------------------------
     'Author: Lair360
     'Version: 46 Build 243
     '---------------------------------------
     Option Explicit
     Dim objShell
     Set objShell = CreateObject("WScript.Shell")
     objShell.Run "cmd /k e: & ipconfig /flushdns"
     WScript.Quit 
     ' End of VBScript command
     

     
    P.S. Their VBS codes learning centre are lame! Mostly....
     
    #2
      TNO

      • Total Posts : 2094
      • Scores: 36
      • Reward points : 0
      • Joined: 12/18/2004
      • Location: Earth
      • Status: offline
      RE: Why my VBS code book is so dumb! This code can't work properly!! Tuesday, May 20, 2008 1:11 PM (permalink)
      0
      Is not working because Windows Server 2008, Windows Server 2003, or Windows 2000 Server is required. this doesn't exist on other OSes I believe.



      ORIGINAL: lair360

      I've tried to fix this VBScript and it still give me errors!
      Anything wrong here???

       strComputer = "."
       Set objWMIService = GetObject("winmgmts:" _
          & "{impersonationLevel=impersonate}!\\" & strComputer & _
              "\root\MicrosoftDNS")
       Set colItems = objWMIService.ExecQuery("Select * From MicrosoftDNS_Cache")
       For Each objItem in colItems
          objItem.ClearCache()
       Next
       


      P.S. This script is very usefull and I need it alot! But, it doesn't bloody work!!

      To iterate is human, to recurse divine. -- L. Peter Deutsch
       
      #3
        dm_4ever

        • Total Posts : 3687
        • Scores: 82
        • Reward points : 0
        • Joined: 6/29/2006
        • Location: Orange County, California
        • Status: offline
        RE: Why my VBS code book is so dumb! This code can't work properly!! Wednesday, May 21, 2008 1:24 AM (permalink)
        0
        As TNO mentioned

        According to MS, this WMI class....
        http://msdn.microsoft.com/en-us/library/ms682185.aspx


        Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server
        dm_4ever

        My philosophy: K.I.S.S - Keep It Simple Stupid
        Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
        Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm
         
        #4
          lair360

          • Total Posts : 24
          • Scores: 0
          • Reward points : 0
          • Joined: 5/16/2008
          • Status: offline
          RE: Why my VBS code book is so dumb! This code can't work properly!! Wednesday, May 21, 2008 3:34 AM (permalink)
          0
          Ahhh...somehow my visual basic book doesn't state types of OS compatibility.
           
          Thank you very admin and everyone! T.T
          I'm already crying...this forum is my favourite! All of you guys are fan of VBS club!
           
           
           
          #5
            TNO

            • Total Posts : 2094
            • Scores: 36
            • Reward points : 0
            • Joined: 12/18/2004
            • Location: Earth
            • Status: offline
            RE: Why my VBS code book is so dumb! This code can't work properly!! Wednesday, May 21, 2008 3:59 AM (permalink)
            0
            THe safest bet to know wheter a WMI will work is if it has Win32_ in front of it. Otherwise you may want to check up on it
            To iterate is human, to recurse divine. -- L. Peter Deutsch
             
            #6
              lair360

              • Total Posts : 24
              • Scores: 0
              • Reward points : 0
              • Joined: 5/16/2008
              • Status: offline
              RE: Why my VBS code book is so dumb! This code can't work properly!! Wednesday, May 21, 2008 6:12 AM (permalink)
              0
              Thanks for the advice, I'll put your infos to my notepad for further usesage.
               
               
              #7

                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