![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | vb script help I have a VB Script that I am running using my Group Policy Editor to delete user profiles during logoff (running Windows XP) . The script works fine when I am logged in as administrator, but when individual users logoff they get an insufficient authority error message associated with the delete line of the script. Does anyone know if there anyway around this problem ? See script below ... ' Set up the scripting environment Option Explicit Const oSrc = "C:\Documents and Settings\20*" Dim Text, Title Dim WSH, FSO, oFolders, oFolder, oSubFolders ' Object variables Dim oFileCount, oFolderCount, oFiles, oCount Text = "Folders" & vbCrLf & vbCrLf ' Dialog title (inc. vanity bit) Title = "Student Profile Deleter" ' Create Windows Scripting Host Shell object Set WSH = WScript.CreateObject("WScript.Shell") ' Create FileSystem object to access the file system. Set FSO = WScript.CreateObject("Scripting.FileSystemObject") 'Delete the folder (forcibly, to handle read-only attributes) FSO.DeleteFolder oSrc,True 'Free memory used by objects Set WSH = Nothing Set FSO = Nothing WScript.Quit() Thanks in advance *** Sent via Developersdex http://www.developersdex.com *** |
My System Specs![]() |
| | #2 (permalink) |
| | Re: vb script help "Norm z" <baileyn@xxxxxx> wrote in message news:ej9FkPNSJHA.1960@xxxxxx Quote: >I have a VB Script that I am running using my Group Policy Editor to > delete user profiles during logoff (running Windows XP) . The script > works fine when I am logged in as administrator, but when individual > users logoff they get an insufficient authority error message associated > with the delete line of the script. Does anyone know if there anyway > around this problem ? See script below ... > > ' Set up the scripting environment > Option Explicit > Const oSrc = "C:\Documents and Settings\20*" > Dim Text, Title > Dim WSH, FSO, oFolders, oFolder, oSubFolders ' Object variables > Dim oFileCount, oFolderCount, oFiles, oCount > Text = "Folders" & vbCrLf & vbCrLf > ' Dialog title (inc. vanity bit) > Title = "Student Profile Deleter" > > ' Create Windows Scripting Host Shell object > Set WSH = WScript.CreateObject("WScript.Shell") > ' Create FileSystem object to access the file system. > Set FSO = WScript.CreateObject("Scripting.FileSystemObject") > > 'Delete the folder (forcibly, to handle read-only attributes) > FSO.DeleteFolder oSrc,True > > > 'Free memory used by objects > Set WSH = Nothing > Set FSO = Nothing > > > WScript.Quit() > > Thanks in advance FSO.DeleteFolder oSrc,True Attempting to delete your own profile folder while logged on is equivalent to sawing off the branch you sit on. Windows won't let you do it and writing a script around it makes no difference. Try doing it from Explorer or a Command Prompt - it won't work either! Note that profile folders are often locked until you reboot the machine. While they are locked nobody can delete them, not even an administrator. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Logon Script Causing Laptops To Hang - Problems in script? | VB Script | |||
| problem passing args to script 'There is no script engine for file extenstion' | VB Script | |||
| Include another script, keep variables in included script? | PowerShell | |||
| Script file has 'OS Handle' error when run from script | PowerShell | |||
| Can you drag-n-drop a file on top of a PS script to run the script? | PowerShell | |||