Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 681

Error on create folder method??

$
0
0
Hello everyone. I'm sorry if this is a newb question or posted in the wrong area. I'm brand new to scripting and still tackling basic file & folder manipulation. I only have a production environment to work with, so I'm having to be rather reserved in my practices. Our company is using a remote server to deploy scripted installations to our computers. I've been tasked with setting this up, and I'm having some issues constructing the scripts to perform the file operations I need done.

Basically all I need this thing to do is create a folder named "oem" in the C:\Windows\System32 directory, then copy 3 files to various locations. I've gotten the file copy figured out, but have been unable to get the script to create the oem folder that's missing. I know the copy functions work, because if I create the folder manually everything works fine, but trying to automate this task has become a nightmare.

I've pasted my code below, but I keep getting an error "Line: 3, Char: 1, Permission Denied, Code: 800A0046". This line is the function that is supposed to create the folder.

I've tried everything I can think of, but I've only been scripting for about 3 days and have used all of my available resources. I've come across multiple different possibilities, but none have resolved my issue. I've tried making a monacre to delegate permissions through WMI or something along those lines, but have no idea what I'm doing on that front. I've seen plenty of videos and other scripts that didn't need to do all of that and were able to create a folder. Also, I know the user account that I am running this under can make folders just fine, because if I do it via the GUI it works just fine. I also already have UAC disabled during this process so I know it's not an issue with UAC.

Any help on this issue would be greatly appreciated, as I can't figure out why such a simple script is getting an error for permissions when I can perform the needed functions manually. What am I missing?

Code: Omitted UNC paths for security
---------------------------------------------------------------------------------
set objTest = CreateObject("Scripting.FileSystemObject")

objTest.CreateFolder "C:\Windows\System32\oem"
objTest.CopyFile "[UNC Path]", "%PROGRAMDATA%\Microsoft\User Account Pictures\"
objTest.CopyFile "[UNC Path]", "%PROGRAMDATA%\Microsoft\User Account Pictures\"
objTest.CopyFile "[UNC Path]", "C:\Windows\System32\oem\"

Viewing all articles
Browse latest Browse all 681

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>