Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


New ...

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,25882
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> New ...
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1] 2   next >   >>
Login
Message << Older Topic   Newer Topic >>
 New ... - 9/13/2005 6:01:20 AM   
  DerekSchauland

 

Posts: 10
Score: 0
Joined: 9/12/2005
Status: offline
I like the idea behind scripting and it seems that it is useful, but what does one do when the snipets dont work...

I am trying to get started and began with some things from the technet script repository and havent had much luck...

Derek
 
 
Post #: 1
 
 RE: New ... - 9/13/2005 7:25:34 AM   
  DiGiTAL.SkReAM


Posts: 1184
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
1.) Set yourself simple tasks, such as "I wanna move this file from here to there" and then do a Google search for "vbscript file move" and check out the results.
2.) Change the task and repeat #1.

Scripting is really just a series of simple tasks all strung together to form a complex chain.  So if you learn the simple stuff to the point where you don't have to refer backt o a book before doing something, just take that knowledge and string a whole bunch of simple tasks together.




_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to DerekSchauland)
 
 
Post #: 2
 
 RE: New ... - 9/13/2005 7:37:49 AM   
  Country73


Posts: 733
Score: 10
Joined: 8/25/2004
From: USA
Status: offline
Welcome,
 
The best thing to start out with is posting the script your working on, state what the script is "supposed" to do, and what problem you're running into with it.
If you're getting an exact line error, then be sure to point that specific line out in bold or in a different color so that we will be able to locate it.

(in reply to DerekSchauland)
 
 
Post #: 3
 
 RE: New ... - 9/13/2005 7:42:54 AM   
  DerekSchauland

 

Posts: 10
Score: 0
Joined: 9/12/2005
Status: offline
Seems funny that these snippets put up by MS have issues... I know they are unsupported but sheesh...

I am hoping to do something with the eventviewer... backup and clear logs on run... send email to admin on complete...

(in reply to DerekSchauland)
 
 
Post #: 4
 
 RE: New ... - 9/13/2005 7:49:37 AM   
  Country73


Posts: 733
Score: 10
Joined: 8/25/2004
From: USA
Status: offline
Which one's are you having issues with?
It's possible that you don't have the right version of VBS on your machine, you don't have the proper rights on you machine, etc...

(in reply to DerekSchauland)
 
 
Post #: 5
 
 RE: New ... - 9/13/2005 7:51:53 AM   
  DerekSchauland

 

Posts: 10
Score: 0
Joined: 9/12/2005
Status: offline
The backup and clear script for event logs

I am domain admin on the network... so I am sure it isnt a permissions issue...

the thing blows up with a syntax error when trying to connect to Winsmgmt

(in reply to Country73)
 
 
Post #: 6
 
 RE: New ... - 9/13/2005 8:07:07 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: online
Your best bet is to:


quote:

ORIGINAL: Country73

Welcome,
 
The best thing to start out with is posting the script your working on, state what the script is "supposed" to do, and what problem you're running into with it.
If you're getting an exact line error, then be sure to point that specific line out in bold or in a different color so that we will be able to locate it.

(in reply to Country73)
 
 
Post #: 7
 
 RE: New ... - 9/13/2005 10:48:02 PM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Along with posting the script, are you running this locally or remotely?  What OS is installed on the system(s)?

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to ebgreen)
 
 
Post #: 8
 
 RE: New ... - 9/13/2005 11:41:39 PM   
  DiGiTAL.SkReAM


Posts: 1184
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline

Sorry, I misunderstood the question.  Thought that you were asking for generic advice on "How do I start scripting?"

The other folks are right.  The best thing to do is to paste the script that you currently have, color the script's text differently so that we can easily amke it out, and then we'll try to figure out what's going wrong.

Again, sorry for the misunderstanding.

_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to mbouchard)
 
 
Post #: 9
 
 RE: New ... - 9/13/2005 11:48:47 PM   
  DerekSchauland

 

Posts: 10
Score: 0
Joined: 9/12/2005
Status: offline
There was no misunderstanding... I do want to look at the best ways to get started (seems just trying isnt the best method anymore)

I have the following:

Dim wmiColl, wmiObj
Dim strComputer
strcomputer = "."
Set wmiColl = GetObject("WinMgmts:\\" & strComputer &"/root/cimv2").ExecQuery("Select * FROM Win32_NTEventlogFile")

For Each wmiObj In wmiColl
    WScript.Echo wmiObj.LogfileName
Next

and get an error referencing 0x80041013 and for the life of me cannot figure out what might cause the error... it says the error is on the Set wmiColl line.

I am hoping to run this both locally and remotely... perhaps strcomputer =  inputbox("enter a pc name", "PC Name") to make it prompt for PC at runtime



(in reply to DiGiTAL.SkReAM)
 
 
Post #: 10
 
 RE: New ... - 9/14/2005 12:06:44 AM   
  Country73


Posts: 733
Score: 10
Joined: 8/25/2004
From: USA
Status: offline
Do you have the Adminpak installed on this machine?

(in reply to DerekSchauland)
 
 
Post #: 11
 
 RE: New ... - 9/14/2005 12:11:31 AM   
  Zifter


Posts: 318
Score: 0
Joined: 1/5/2005
From: Belgium
Status: offline
I tested your code and it ran without errors. I got the following (expected) output:

Application
Security
System


The error code you have, means the following (from MSDN):
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_error_constants.asp

WBEM_E_PROVIDER_LOAD_FAILURE
0x80041013
COM cannot locate a provider referenced in the schema.
This error may be caused by any of the following:
  • Provider is using a WMI DLL that does not match the .lib file used when the provider was built.
  • Provider's DLL, or any of the DLLs on which it depends, is corrupt.
  • Provider failed to export DllRegisterServer.
  • In-process provider was not registered using the regsvr32 command.
  • Out-of-process provider was not registered using the /regserver switch.

(in reply to DerekSchauland)
 
 
Post #: 12
 
 RE: New ... - 9/14/2005 12:24:46 AM   
  DerekSchauland

 

Posts: 10
Score: 0
Joined: 9/12/2005
Status: offline
I loaded adminpak and it didnt help...

Any way to figure our what files are screwed up that might cause the error?

(in reply to Zifter)
 
 
Post #: 13
 
 RE: New ... - 9/14/2005 1:02:56 AM   
  DerekSchauland

 

Posts: 10
Score: 0
Joined: 9/12/2005
Status: offline
Seems that my 0x80041013 has migrated down to For Each wmiObj In wmiColl in the script...

but both of these items are defined as variables...

(in reply to DerekSchauland)
 
 
Post #: 14
 
 RE: New ... - 9/14/2005 1:03:43 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
What OS are you running this on?

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to DerekSchauland)
 
 
Post #: 15
 
 RE: New ... - 9/14/2005 1:12:43 AM   
  DerekSchauland

 

Posts: 10
Score: 0
Joined: 9/12/2005
Status: offline
XP SP 2

(in reply to mbouchard)
 
 
Post #: 16
 
 RE: New ... - 9/14/2005 1:23:57 AM   
  DiGiTAL.SkReAM


Posts: 1184
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
Do you get that error regardless of what machine you run the script on?  Have you tried running it on other machines?  Maybe that one computer has a corrupt DLL or two...

_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to DerekSchauland)
 
 
Post #: 17
 
 RE: New ... - 9/14/2005 1:27:42 AM   
  DerekSchauland

 

Posts: 10
Score: 0
Joined: 9/12/2005
Status: offline
Works ok on other machines..

that figures

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 18
 
 RE: New ... - 9/14/2005 2:27:58 AM   
  DerekSchauland

 

Posts: 10
Score: 0
Joined: 9/12/2005
Status: offline
Is this stuff supposed to be this picky?

I changed a few things in the script after I got it working and I am back to broke again...

I wanted to specify in a popup box the current date to append it to the file name on backup and it doesnt like that at all...

(in reply to DerekSchauland)
 
 
Post #: 19
 
 RE: New ... - 9/14/2005 4:35:26 AM   
  DiGiTAL.SkReAM


Posts: 1184
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
Pretty muche very language that you will be coding in has its own set of rules for syntax, etc.



_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to DerekSchauland)
 
 
Post #: 20
 
 
Page:   [1] 2   next >   >>
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> New ... Page: [1] 2   next >   >>
Jump to:





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
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts