VBS Script To Delete A Directory Folder On A Local Machine

 

This VBS script can be used to delete a folder and all of its contents including any subfolders on a local machine. The script can be distributed as is or can be used in a group policy.

 

VBS Script:

 

strFolderName = "C:\Test"

Set fso = CreateObject("Scripting.FileSystemObject")

If fso.FolderExists(strFolderName) Then

fso.DeleteFolder strFolderName

End If

MsgBox "Done"

 

 

 

Published Monday, May 26, 2008 7:42 AM by dhite
Filed under:

Comments

# re: VBS Script To Delete A Directory Folder On A Local Machine

It is easy to get the PDC Role holder:

Set oSI = CreateObject("ADSystemInfo")

tArray = split(oSI.PDCRoleOwner,",CN=")

strPDC = tArray(1)

WScript.Echo strPDC

Tuesday, May 27, 2008 10:25 AM by Kaplaa

# fso

Pingback from  fso

Thursday, June 12, 2008 1:13 PM by fso