5 thoughts on “Cleaning up profiles on Citrix/Terminal Servers/etc with PowerShell

  1. Nikhil Vaish

    Great script..was wondering how we can use this to delete Citrix profile from multiple servers..

    Reply
    1. admin Post author

      If you don’t have access to any deployment tools (Altiris, SCCM etc.) you could run it with Invoke-Command/New-PSSession I guess, or through WMI.

      Scheduling locally is always an option aswell, but it’s rather messy to keep track of…

      Reply
    2. Craig

      Thanks for the script, it works great. Is it possible to add another logic to delete profiles older than 30 days?

      Kind regards
      Craig

      Reply
  2. Martin

    Great script, is there an easy to get it to log to a text file which profiles were deleted?

    Reply
    1. Anders Post author

      Glad it is useful!

      Sure, you see the line that says:
      Write-Output ā€œ$CurrentProfileName has been deleted.ā€

      You could simply add something similar to this “pseudo code” after that (on the same line):
      | Out-File -Path “file path” -Append

      Where “file path” is the full path to the log file you want to use. I’m not at a computer at the moment but if you have any issues getting that to work, ping me again and I’ll be happy to help you out and provide a more full example.

      Reply

Leave a Reply to admin Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.