Skip to content

Instantly share code, notes, and snippets.

@lansalot
Created December 22, 2021 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lansalot/953c2b46ae48e1b18b18a49e5894a565 to your computer and use it in GitHub Desktop.
Save lansalot/953c2b46ae48e1b18b18a49e5894a565 to your computer and use it in GitHub Desktop.
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)][String] $ADGroupGUID,
[Parameter(Mandatory = $true)][String] $VHDXLocation
)
If ($ADGroupGUID -NotMatch "S-1-5-") {
Write-Warning "Looks like ADGroupGUID is NOT a GUID - Aborting FSLogic config!!!"
Exit
}
Write-Output "Creating FSLogix keys for AD Group GUID $($ADGroupGUID) at $($VHDXLocation)"
New-Item HKLM:\Software\FSLogix\Profiles -Force | Out-Null
New-ItemProperty HKLM:\Software\FSLogix\Profiles -Name Enabled -PropertyType Dword -Value 1 | Out-Null
New-Item HKLM:\Software\FSLogix\Profiles\ObjectSpecific | Out-Null
New-Item HKLM:\Software\FSLogix\Profiles\ObjectSpecific\$($ADGroupGUID) | Out-Null
New-ItemProperty HKLM:\Software\FSLogix\Apps -Name CleanupInvalidSessions -PropertyType Dword -Value 1 | Out-Null
New-ItemProperty HKLM:\Software\FSLogix\Profiles\ObjectSpecific\$($ADGroupGUID) -Name FlipFlopProfileDirectoryName -PropertyType Dword -Value 1 | Out-Null
New-ItemProperty HKLM:\Software\FSLogix\Profiles\ObjectSpecific\$($ADGroupGUID) -Name IncludeOneDrive -PropertyType Dword -Value 0 | Out-Null
New-ItemProperty HKLM:\Software\FSLogix\Profiles\ObjectSpecific\$($ADGroupGUID) -Name DeleteLocalProfileWhenVHDShouldApply -PropertyType Dword -Value 1 | Out-Null
New-ItemProperty HKLM:\Software\FSLogix\Profiles\ObjectSpecific\$($ADGroupGUID) -Name PreventLoginWithTempProfile -PropertyType Dword -Value 1 | Out-Null
New-ItemProperty HKLM:\Software\FSLogix\Profiles\ObjectSpecific\$($ADGroupGUID) -Name PreventLoginWithFailure -PropertyType Dword -Value 1 | Out-Null
New-ItemProperty HKLM:\Software\FSLogix\Profiles\ObjectSpecific\$($ADGroupGUID) -Name VolumeType -PropertyType String -Value "vhdx" | Out-Null
$VhdLoc = @"
$($VHDXLocation)
"@
New-ItemProperty HKLM:\Software\FSLogix\Profiles\ObjectSpecific\$($ADGroupGUID) -Name VHDLocations -PropertyType MultiString -Value $VhdLoc | Out-Null
Write-Output "Create-FSLogixConfig.ps1 ends"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment