Created
November 21, 2014 04:22
-
-
Save dstreefkerk/6eea12da852ac69b7c4f to your computer and use it in GitHub Desktop.
Remove VDM files for all users, for HP FileSite for Outlook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Remove-FilesiteViews.ps1 - Remove VDM files for all users | |
.DESCRIPTION | |
This script is designed to be run under the SYSTEM account, as it needs | |
access to every user's profile. This will work fine as a scheduled task, or | |
under SCCM or similar. | |
As per the release notes for Filesite 9.0 Update 5, all VDM files need to be deleted | |
before performing the upgrade. | |
.OUTPUTS | |
Nothing | |
.LINK | |
https://gist.github.com/dstreefkerk/6eea12da852ac69b7c4f | |
.NOTES | |
Written By: Daniel Streefkerk | |
Website: http://daniel.streefkerkonline.com | |
Twitter: http://twitter.com/dstreefkerk | |
Todo: Nothing at the moment | |
#> | |
# User profile base path | |
$searchPath = "c:\users" | |
# Locate all VDM files in user profiles only in folders with the path like *iOutlook* | |
$viewFiles = Get-ChildItem -Path $searchPath -Filter "*.vdm" -Recurse -Force -ErrorAction SilentlyContinue | ? {$_.DirectoryName -like "*iOutlook"} | |
# Get all Outlook processes | |
$outlookProcesses = Get-Process "outlook" -ErrorAction SilentlyContinue | |
# If Outlook is running, kill it | |
if (($outlookProcesses | Measure-Object).Count -gt 0) { | |
$outlookProcesses | Stop-Process -Force | |
# Wait for outlook processes to close | |
Wait-Process "outlook" | |
} | |
# Sleep for 5 seconds, as Outlook still seems to hold views.vdm open for a little bit after the process has ended | |
Start-Sleep 5 | |
# Remove the VDM files | |
$viewFiles | Remove-Item -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment