You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
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.)
The text was updated successfully, but these errors were encountered:
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
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.
Same test.ps1:
PS C:> .\test.ps1 -ProfilePath ""
True
PS C:>
This is what gets added to HKLM\Software\FSLogix\Profiles
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.)
The text was updated successfully, but these errors were encountered: