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

File/Folder Deletes

$
0
0
Hi All, bit of a newbie struggling with a VB issue...

I have a script that performs a few actions (registry entries, clearing down appdata paths) etc. howevver am struggling with one part.

All my other actions run within the user profile without elevation (great for me)

However I have a situation where I have a folder in c:\programdata however the issue is the local user is a restriceted account and does not have rights to delete all the contents.

the extract of script I am stuck on is:

Code:

Dim objFSO, copyFile, vSystemDrive
Set WshShell = WScript.CreateObject("Wscript.Shell")
vPROGRAMDATA = WshShell.ExpandEnvironmentStrings("%PROGRAMDATA%")
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFolder(vPROGRAMDATA & "\KC")

Can anyone help me to either...

a.) have some code to selectively only delete files the user has rights to.

b.) (This would be ideal), be able to have the script prompt for a domain user account, specify it and delete the folder with the rights of the specified account (an admin).

If anyone could help with either of these it would be VERY much appreaciated

Viewing all articles
Browse latest Browse all 688

Trending Articles



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