troubleshooting Question

VBSCRIPT Create Folder In user MY Documents and set properties

Avatar of luke311
luke311 asked on
Visual Basic Classic
8 Comments2 Solutions953 ViewsLast Modified:

Ok I'm wanting to write a script for laptop users, they will receive script in email and run, that creates a folder called "Protected" in their My documents folder and set the properties (right-click folder, under general select advanced, check Encrypt contents to secure data).
I have found something similar on search but I can't get that code work properly, here's what I have so far:

Dim sMyDocumentsFolder,sNewFolder,fso,wshShell,sNetworkPath

Set fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("Wscript.Shell")

'set parent directory for your new folder
sNetworkPath = "C:\document and settings\"      

'Get My Documents Folder
sMyDocumentsFolder = WshShell.ExpandEnvironmentStrings("%USERPROFILE%") & "\My Documents\"

'Name the new folder Protected.
sNewFolder = ("Protected")

fso.CreateFolder sMyDocumentsFolder, sNetworkPath & sNewFolder , True

Any ideas how to do this???  

Any help will be greatly appreciated.
Chris Dent
PowerShell Developer
Join our community to see this answer!
Unlock 2 Answers and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros