Jump to content

Recommended Posts

Posted

I have 170 controlled assessment accounts that i want to empty and reuse in the future.

 

I don't really want to go into 170 accounts and delete the contents.

 

I know there must be a way using power shell to load up account001 - account170 then tell it to delete the contents.

 

any ideas.

 

---

 

first time posting on here in a long time - was a long time user until changed jobs

Posted
they are generic controlled assessment account that have been backed up. i want to empty them and reuse.

 

Would it not be easier to delete all the shares (and content) and then re-create them with a script?

 

something like:

 

mkdir.bat

mkdir D:\Users\%3\%4

net share %1$ /d

net share %1$=D:\Users\%3\%4 /users:5 /Grant:Everyone,full

echo y|cacls D:\Users\%3\%4 /t /c /g %1:c "CREATOR OWNER":f "Domain Admins":f Staff:c Administrators:f

 

 

pupils.bat

@call mkdir.bat t5540 space controlled2014 t5540

Posted

This is what I use.

 

This leave all user folders but removes all contents

 

# copy to Folder ABOVE the folders containg files to be removed
# eg  Examinations-
#                  |-Exam1
#                  |-Exam2
# To delete contents of Exam1-Exam2
# Place script in Examinations folder
# This will Delete ALL files inc. hidden & system
# You have been warned!
Write-Host "This will Delete ALL subfiles, inc. hidden & system files..."
Write-Host "You have been warned!..."
Write-Host "Press any key to continue ..."

$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

get-childitem $PWD/*/* -include *.* -force -recurse | foreach ($_) {remove-item -force -recurse $_.fullname}

 

Open powershell

CD to Examination DIR

Run script

 

Please test before real world use.

 

BoX

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...