-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCitrixPVSspeedup.ps1
38 lines (34 loc) · 1.13 KB
/
CitrixPVSspeedup.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Script path and INI file
$BaseFolder = $(Split-Path -parent $MyInvocation.MyCommand.Definition) + "\";
$CitrixCSV = $BaseFolder + "CitrixSpeedUp.csv"
# Funtions
function FileToCache ($File) {
# Slow
#[System.IO.File]::ReadAllBytes($File)
#
# Quicker but need to be tested
#Get-Content -Raw $File.FullName
Write-Output $File
}
# Read CSV configuration file
$csv = Import-Csv -Path $($CitrixCSV) -Delimiter ","
# CSV
# AppFileDirectory,extension1,extension2,extension3
#
foreach ($line in $csv) {
if ($line.AppFileDirectory -ne ""){
# is a file?
if (Test-Path $line.AppFileDirectory -PathType Leaf){
FileToCache -File $line.AppFileDirectory
}
# is a directory?
if (Test-Path $line.AppFileDirectory -PathType Container){
if ($line.SearchFilter -eq ""){
$line.SearchFilter = "*.exe"
}
foreach ($File in (Get-ChildItem -Path $line.AppFileDirectory -Recurse -File -Include $line.SearchFilter)) {
FileToCache -File $File.FullName
}
}
}
}