[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 158
  • Last Modified:

VB Script error

Hey guys.

So, I've been trying to teach myself scripting by looking at my company's existing scripts and attempting to reverse engineer.  I've had some experience with scripting and programming many moons ago, but I can still more or less follow what's going on.

So, I have a maddening issue.  A script created in 2004 by either a former employee or one found on the internet intermittently works.  The job of the script is to take an AD group as input, verify the domain and OU and return a list of accounts in that group.  As I've said, it works sometimes and other times it fails with an access denied message on a specific line.  I've added it below.

Set objGroupLog = fso.CreateTextFile(strGroupLog, True)

This line is in a section where it's trying to write a log, but I'm not sure where it's trying to write to.  I have more lines of the script, but have seen people be annoyed at posters for copy and pasting the entire script.  I can add any info you'd like to give me a hand.
0
Ray Drummond
Asked:
Ray Drummond
  • 3
  • 2
  • 2
2 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
Check the content of strGrouplog variable, it contains the file name. If that contains some special character not allowed for file names, this could raise this error
0
 
Ray DrummondLan Administrator IIIAuthor Commented:
Hi Guy.

Thanks for responding.  I think this is the line you're referencing.

strGroupLog = "c:\" & strGroup & "_" & strDateStamp & ".txt"

When I run the script, where I would enter the group name there is a value already listed and I have to delete it and enter the correct group name.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
So can you show some group names where your script goes into the error?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
sirbountyCommented:
(Hi Guy :^)

My guess would be it's not launching from an elevated environment.  Typical users won't have access to write to the root of C:
Either launch the script elevated, or modify the variable strGroupLog.

Example:
strGroupLog = "c:\ADGroupInfo\" & strGroup & "_" & strDateStamp & ".txt"

Open in new window

'(Make sure C:\AdGroupInfo exists before running)
0
 
Ray DrummondLan Administrator IIIAuthor Commented:
So, both of you helped, but it turns out that SirBounty's info is what fixed the issue.  I always commented to colleagues that it always worked on Windows XP.  Forgot about that difference to Windows 7

Thank you both.
0
 
Ray DrummondLan Administrator IIIAuthor Commented:
Another step closer to understanding this.  Thanks.
0
 
sirbountyCommented:
Glad you found your solution.  Thanks for the grade! :^)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now