Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Folder wont delete access denied

Status
Not open for further replies.

GrimR

IS-IT--Management
Jun 17, 2007
1,149
ZA
All Dim's at top of script
StartMenu = WshShell.SpecialFolders("StartMenu")

Tried both methods and they both fail.

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFolders = objWMIService. ExecQuery("Select * From Win32_Directory Where Name ='" & StartMenu & "\\Programs\\Time'")

For Each objFolder in colFolders
errResults = objFolder.Delete
Next

and

Delete_Time = StartMenu & "\Programs\Time"
wscript.echo Delete_Time
If objfso.FolderExists(Delete_Time) Then
objfso.DeleteFolder Delete_Time
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top