Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in parameter validation in FSLogix.ps1 #751

Open
mvaferreira opened this issue May 30, 2023 · 0 comments
Open

Bug in parameter validation in FSLogix.ps1 #751

mvaferreira opened this issue May 30, 2023 · 0 comments

Comments

@mvaferreira
Copy link

mvaferreira commented May 30, 2023

hello team, there is a bug in the validation here

This script isn't validating empty string correctly using $PSBoundParameters.ContainsKey('ProfilePath'). Azure Portal is sending an empty string but this is always returning true.

Azure Virtual Desktop Image Builder is adding CCDLocations to VM registry as "type=smb,connectionString=" because $ProfilePath is empty.

Azure Portal says it is optional to send "Profile path", and when doing so, the script won't correctly validate empty or null string.

image

Same test.ps1:

Param (        
    [Parameter(Mandatory=$false)]
        [string]$ProfilePath
)

$PSBoundParameters.ContainsKey('ProfilePath') #<-- will return true with empty string

PS C:> .\test.ps1 -ProfilePath ""
True
PS C:>

This is what gets added to HKLM\Software\FSLogix\Profiles

image

Please make sure $ProfilePath validated for not being null or empty, otherwise, when logging on to the VM using FSLogix, it will throw error below:

[16:42:21.826][tid:00000ba4.00001350][ERROR:00000021] LoadProfile failed. Version: 2.9.8171.14983 User: . SID: . SessionId: 6. FrxStatus: 33 (The process cannot access the file because another process has locked a portion of the file.)

@mvaferreira mvaferreira changed the title Bug in parameters validation in CustomImageTemplateScripts/CustomImageTemplateScripts_2023-04-19/FSLogix.ps1 Bug in parameter validation in FSLogix.ps1 May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant