forked from achawla5/PSScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFSLogix.ps1
156 lines (142 loc) · 4.64 KB
/
FSLogix.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<#Author : Dean Cefola
# Creation Date: 10-15-2020
# Usage : Setup FSLogix
#********************************************************************************
# Date Version Changes
#------------------------------------------------------------------------
# 10/15/2020 1.0 Intial Version
#
#
#*********************************************************************************
#
#>
Param (
[Parameter(Mandatory=$true)]
[string]$ProfilePath,
[Parameter(Mandatory=$false)]
[string]$VHDSize
)
######################
# WVD Variables #
######################
$LocalWVDpath = "c:\temp\wvd\"
$FSLogixURI = 'https://aka.ms/fslogix_download'
$FSInstaller = 'FSLogixAppsSetup.zip'
$templateFilePathFolder = "C:\AVDImage"
####################################
# Test/Create Temp Directory #
####################################
if((Test-Path c:\temp) -eq $false) {
Write-Host "AVD AIB Customization - Install FSLogix : Creating temp directory"
New-Item -Path c:\temp -ItemType Directory
}
else {
Write-Host "AVD AIB Customization - Install FSLogix : C:\temp already exists"
}
if((Test-Path $LocalWVDpath) -eq $false) {
Write-Host "AVD AIB Customization - Install FSLogix : Creating directory: $LocalWVDpath"
New-Item -Path $LocalWVDpath -ItemType Directory
}
else {
Write-Host "AVD AIB Customization - Install FSLogix : $LocalWVDpath already exists"
}
#################################
# Download WVD Componants #
#################################
Write-Host "AVD AIB Customization - Install FSLogix : Downloading FSLogix from URI: $FSLogixURI"
Invoke-WebRequest -Uri $FSLogixURI -OutFile "$LocalWVDpath$FSInstaller"
##############################
# Prep for WVD Install #
##############################
Write-Host "AVD AIB Customization - Install FSLogix : Unzipping FSLogix installer"
Expand-Archive `
-LiteralPath "C:\temp\wvd\$FSInstaller" `
-DestinationPath "$LocalWVDpath\FSLogix" `
-Force `
-Verbose
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Set-Location $LocalWVDpath
Write-Host "AVD AIB Customization - Install FSLogix : UnZip of FSLogix complete"
#########################
# FSLogix Install #
#########################
Write-Host "AVD AIB Customization - Install FSLogix : Starting to install FSLogix"
$fslogix_deploy_status = Start-Process `
-FilePath "$LocalWVDpath\FSLogix\x64\Release\FSLogixAppsSetup.exe" `
-ArgumentList "/install /quiet" `
-Wait `
-Passthru
if(!($PSBoundParameters.ContainsKey('VHDSize'))) {
$VHDSize = "30000"
}
#######################################
# FSLogix User Profile Settings #
#######################################
Write-Host "AVD AIB Customization - Install FSLogix : Configure FSLogix Profile Settings"
Push-Location
Set-Location HKLM:\SOFTWARE\
New-Item `
-Path HKLM:\SOFTWARE\FSLogix `
-Name Profiles `
-Value "" `
-Force
New-Item `
-Path HKLM:\Software\FSLogix\Profiles\ `
-Name Apps `
-Force
Set-ItemProperty `
-Path HKLM:\Software\FSLogix\Profiles `
-Name "Enabled" `
-Type "Dword" `
-Value "1"
New-ItemProperty `
-Path HKLM:\Software\FSLogix\Profiles `
-Name "CCDLocations" `
-Value "type=smb,connectionString=$ProfilePath" `
-PropertyType MultiString `
-Force
Set-ItemProperty `
-Path HKLM:\Software\FSLogix\Profiles `
-Name "SizeInMBs" `
-Type "Dword" `
-Value $VHDSize
Set-ItemProperty `
-Path HKLM:\Software\FSLogix\Profiles `
-Name "IsDynamic" `
-Type "Dword" `
-Value "1"
Set-ItemProperty `
-Path HKLM:\Software\FSLogix\Profiles `
-Name "VolumeType" `
-Type String `
-Value "vhdx"
Set-ItemProperty `
-Path HKLM:\Software\FSLogix\Profiles `
-Name "FlipFlopProfileDirectoryName" `
-Type "Dword" `
-Value "1"
Set-ItemProperty `
-Path HKLM:\Software\FSLogix\Profiles `
-Name "SIDDirNamePattern" `
-Type String `
-Value "%username%%sid%"
Set-ItemProperty `
-Path HKLM:\Software\FSLogix\Profiles `
-Name "SIDDirNameMatch" `
-Type String `
-Value "%username%%sid%"
Set-ItemProperty `
-Path HKLM:\Software\FSLogix\Profiles `
-Name DeleteLocalProfileWhenVHDShouldApply `
-Type DWord `
-Value 1
#Cleanup
if ((Test-Path -Path $templateFilePathFolder -ErrorAction SilentlyContinue)) {
Remove-Item -Path $templateFilePathFolder -Force -Recurse -ErrorAction Continue
}
if ((Test-Path -Path $LocalWVDpath -ErrorAction SilentlyContinue)) {
Remove-Item -Path $LocalWVDpath -Force -Recurse -ErrorAction Continue
}
#############
# END #
#############