+ Post New Thread
Results 1 to 7 of 7
Windows Thread, Enabling defrag for those less fortunate enough to have admin rights in Technical; We have a certain member of staff here who does not like not having admin rights to her school issued ...
  1. #1
    Oops_my_bad's Avatar
    Join Date
    Jan 2007
    Location
    Man chest hair
    Posts
    1,738
    Thank Post
    438
    Thanked 53 Times in 50 Posts
    Rep Power
    30

    Enabling defrag for those less fortunate enough to have admin rights

    We have a certain member of staff here who does not like not having admin rights to her school issued laptop. Of course this means we are forever getting complaints that she cant do this that or the other. Well, every request has been dealt with by way of permissions or minor GP changes as they were reasonable, but still no admin rights needed xD

    She has now asked if she can have rights to defrag her laptop.

    I mean wtf.. I didn't think NTFS defragged that badly anyway to have to perform routing defrags, but as it happens I can't seem to enable this feature. I've enabled the defrag MMC in GP but still the user does not have any rights.

    Whats the best way of going about this to allow a non-administrative user rights to defrag? Apart from telling her to sawd awf..?

  2. #2

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    Boston, MA
    Posts
    7,597
    Thank Post
    109
    Thanked 770 Times in 598 Posts
    Rep Power
    183
    It doesn't exactly fix your problem but you could schedule the defrag for the teacher.

  3. Thanks to Ric_ from:

    Oops_my_bad (23rd February 2008)

  4. #3

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,248
    Thank Post
    1,059
    Thanked 1,069 Times in 625 Posts
    Rep Power
    740
    You may be able to script it - use a RunAsSet in AutoIT which fires off the default defrag tool - or have you tried running it from a command line ?

    defrag c: -f

  5. #4
    Oops_my_bad's Avatar
    Join Date
    Jan 2007
    Location
    Man chest hair
    Posts
    1,738
    Thank Post
    438
    Thanked 53 Times in 50 Posts
    Rep Power
    30
    yeh, the scheduled task seems to be doing the trick as long as I run as, do you know how it handles the laptop not being on at the scheduled time?

  6. #5

    Join Date
    Apr 2007
    Location
    Croydon
    Posts
    504
    Thank Post
    18
    Thanked 31 Times in 30 Posts
    Rep Power
    22
    What you could do (depending on how much you trust the people in quesiton) is within the Local Group Policy of the machine assign them the right to 'perform volume maintainence tasks'. This will allow them to defrag a volume with out admin rights then you don't have to reply on schedules and whether the machine is on or not etc... - it does however allow others things, such as disk converstions.

  7. Thanks to adamf from:

    Oops_my_bad (23rd February 2008)

  8. #6

    Michael's Avatar
    Join Date
    Dec 2005
    Location
    Birmingham
    Posts
    9,297
    Thank Post
    242
    Thanked 1,586 Times in 1,263 Posts
    Rep Power
    344
    Does she even know what defragging is? I had another user recently who asked a similar question but I put them right and said it wasn't necessary.

    And secondly, if there was a serious Windows problem I could re-image in 10 minutes. Defragging can take much longer. I'd also allow Scandisk whilst you're at it, as sometimes Defrag won't run if the hard drive is more than 10% fragmented.

  9. #7
    Osprey's Avatar
    Join Date
    Mar 2007
    Location
    West Yorkshire
    Posts
    65
    Thank Post
    0
    Thanked 6 Times in 4 Posts
    Rep Power
    17
    We copy the following vbs to c:\defrag and run task.vbs
    For domain workstations we use a startup script to see if it is there and if it isn't we copy it onto the workstations and run task.vbs
    defrag.vbs is scheduled to run on Wed at 12:30


    'defrag.vbs
    'Defrags all hard disks - Can be run as a Scheduled Task
    'Modified to create an error log and display it
    '© Doug Knox - 4/13/2002

    Option Explicit

    Dim WshShell, fso, d, dc, ErrStr(), Return, X, A(), MyFile, I, MyBox, Drive

    Set WshShell = WScript.CreateObject("WScript.Shell")
    Set fso = CreateObject("Scripting.FileSystemObject")
    X = 0

    Set dc = fso.Drives
    For Each d in DC
    If d.DriveType = 2 Then
    X = X + 1

    'Determine drive letter of first fixed disk
    'This is the drive that the error report will be placed on
    If X = 1 Then
    Drive = d
    End If
    End If
    Next

    ReDim A(X)
    ReDim ErrStr(X)

    X = 0
    For Each d in dc
    If d.DriveType = 2 Then
    X = X + 1
    Return = WshShell.Run("defrag " & d & " -f", 1, TRUE)

    'Determine the Error code returned by Defrag for the current drive and save it
    If return = 0 then
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag completed successfully" & vbCRLF
    elseif return = 1 then
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level " & return & " (defrag was cancelled manually) " & vbCRLF
    elseif return = 2 then
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level " & return & " (there was a command line error. Check your command line for valid switches and drives)" & vbCRLF
    elseif return = 3 then
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level " & return & " (there was an unknown error)" & vbCRLF
    elseif return = 4 then
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level " & return & " (defrag could not run due to insufficient memory resources)" & vbCRLF
    'errorlevel 5 is not currently used
    elseif return = 5 then
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level " & return & " (general error)" & vbCRLF
    elseif return = 6 then
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level " & return & "(System error: either the account used to run defrag is not an administrator, there is a problem loading the resource DLL, or a defrag engine could not be accessed. Check for proper user permissions and run Sfc.exe to validate system files)" & vbCRLF
    elseif return = 7 then
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level " & return & " (There is not enough free space on the drive. Defrag needs 15% free space to run on a volume)" & vbCRLF
    else
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with an unknown error level: " & return & vbCRLF
    end if

    End If
    Next

    'Create the Error Report in the root of the first fixed disk.
    Set MyFile = fso.OpenTextFile(Drive & "\defragreport.txt", 2, True)
    MyFile.WriteLine(Date) & vbCRLF
    MyFile.WriteLine(Time) & vbCRLF
    For I = 1 to X
    MyFile.WriteLine(ErrStr(I))
    Next
    MyFile.Close

    Return = WshShell.Run(Drive & "\defragreport.txt",3,True)

    Set WshShell = Nothing
    Set fso = Nothing


    'task.vbs
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

    Set objNewJob = objWMIService.Get("Win32_ScheduledJob")

    errJobCreated = objNewJob.Create _
    ("c:\defrag\defrag.vbs", "********123000.000000-000", _
    True , 4, , , JobID)
    Wscript.Echo errJobCreated



SHARE:
+ Post New Thread

Similar Threads

  1. Staff Admin rights
    By itgeek in forum Windows
    Replies: 26
    Last Post: 22nd February 2008, 10:30 AM
  2. Replies: 11
    Last Post: 20th February 2008, 11:14 AM
  3. grant temp admin rights
    By mtupker in forum Scripts
    Replies: 17
    Last Post: 8th September 2007, 08:55 PM
  4. Connection Fails Without Admin Rights
    By MrDylan in forum ICT KS3 SATS Tests
    Replies: 8
    Last Post: 12th May 2006, 01:23 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •