Skip to content

Latest commit

 

History

History
54 lines (44 loc) · 2.19 KB

README.md

File metadata and controls

54 lines (44 loc) · 2.19 KB

Delprof2_BatchRunnerAndLogger

A PowerShell script to run Delprof2 on multiple remote computers and log the results

Description
This script will run the application Delprof2 on multiple computers with the given parameters and log the results. This can be usefull for machines that get filled up with userprofiles.

Requirements

How to Use

  A;B;C;D  
  newline = new computer
  A) Name of the Computer
     (/c parameter in Delprof2)
  B) true=run simulated (WhatIf)
     false=run
     (/l parameter in Delprof2)
  C) Only delete profiles that has not been used in X days.
     (/d parameter in Delprof2)
  D) Description, just notes
  
  Example: DESKTOP123;false;7;Meeting room computer, delete userprofiles not used in one week.
  • Download the script and change the following variables:
    $computers_txt = "D:\Delprof2_BatchRunnerAndLogger\computers.txt" #textfile with list of computers and parameters
    $computers_txt_skip_lines = "1" #How many lines to skip in $computers_txt file (If you want to write some instructions in top etc)
    $delprof_log_folder = "D:\Delprof2_BatchRunnerAndLogger\logs" #folder where the Delprof2 logs are saved
    $script_log_folder = "D:\Delprof2_BatchRunnerAndLogger\logs" #folder where script logs are saved
    $script_log_filename = "scriptrun_log.txt" #name of the script log
    $delprof_exe = "D:\Delprof2_BatchRunnerAndLogger\DelProf2.exe" #location of DelProf2 exe-file.
  • Run or add to Windows Task Scheduler

Running as Task in Windows Task Scheduler

Here is an exable of action:

    Program/script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    Add arguments (optional): -noprofile -executionpolicy bypass -file "D:\Delprof2_BatchRunnerAndLogger\Delprof2_BatchRunnerAndLogger.ps1"
    Start in (optional): D:\Delprof2_BatchRunnerAndLogger\

Changelog

  • 27.02.2019
    • Release