Skip to content

[Bug] Variables are not converted when used as parameter inputs to functions #4

Open
@Richk-1

Description

@Richk-1

Prerequisites

PSAppDeployToolkit.Tools version

0.2.1

PSAppDeployToolkit version

4.0.3

Describe the bug

Using Convert-ADTDeployment it doesn't convert -SID $UserProfile.SID to $_.SID for Invoke-HKCURegistrySettingsForAllUsers \ Invoke-ADTAllUsersRegistryAction

[Installation] :: Failed to modify the registry hive for User [XXXX\XXXX] with SID [S-1-5-21-111111111-111111111-9999999999-XXXX]
Error Record:


Message               : The variable '$UserProfile' cannot be retrieved because it has not been set.
                        
FullyQualifiedErrorId : VariableIsUndefined,Invoke-ADTAllUsersRegistryAction

Steps to reproduce

1.Use Convert-ADTDeployment to an older script that is using invoke-HKCURegistrySettingsForAllUsers with the parameter -SID $UserProfile.SID
2.Run new install
3.Check log.

Environment data

OsName               : Microsoft Windows 11 Enterprise
OSDisplayVersion     : 23H2
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsProductName   : Windows 10 Enterprise
WindowsBuildLabEx    : 22621.1.amd64fre.ni_release.220506-1250
OsLanguage           : en-US
OsMuiLanguages       : {en-US}
KeyboardLayout       : en-GB
TimeZone             : (UTC+00:00) Dublin, Edinburgh, Lisbon, London
HyperVisorPresent    : True
CsPartOfDomain       : True
CsPCSystemType       : Mobile


Host:
  Version:      8.0.11
  Architecture: x64
  Commit:       9cb3b725e3
  RID:          win-x64

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions