@@ -163,10 +163,10 @@ public static void LoadProfiles(this PowerShell pwsh, ProfilePathInfo profilePat
163
163
{
164
164
var profileVariable = new PSObject ( ) ;
165
165
166
- pwsh . AddProfileMemberAndLoadIfExists ( profileVariable , nameof ( profilePaths . AllUsersAllHosts ) , profilePaths . AllUsersAllHosts ) ;
167
- pwsh . AddProfileMemberAndLoadIfExists ( profileVariable , nameof ( profilePaths . AllUsersCurrentHost ) , profilePaths . AllUsersCurrentHost ) ;
168
- pwsh . AddProfileMemberAndLoadIfExists ( profileVariable , nameof ( profilePaths . CurrentUserAllHosts ) , profilePaths . CurrentUserAllHosts ) ;
169
- pwsh . AddProfileMemberAndLoadIfExists ( profileVariable , nameof ( profilePaths . CurrentUserCurrentHost ) , profilePaths . CurrentUserCurrentHost ) ;
166
+ pwsh . AddProfileMemberAndLoadIfExists ( profileVariable , nameof ( profilePaths . AllUsersAllHosts ) , profilePaths . AllUsersAllHosts )
167
+ . AddProfileMemberAndLoadIfExists ( profileVariable , nameof ( profilePaths . AllUsersCurrentHost ) , profilePaths . AllUsersCurrentHost )
168
+ . AddProfileMemberAndLoadIfExists ( profileVariable , nameof ( profilePaths . CurrentUserAllHosts ) , profilePaths . CurrentUserAllHosts )
169
+ . AddProfileMemberAndLoadIfExists ( profileVariable , nameof ( profilePaths . CurrentUserCurrentHost ) , profilePaths . CurrentUserCurrentHost ) ;
170
170
171
171
pwsh . Runspace . SessionStateProxy . SetVariable ( "PROFILE" , profileVariable ) ;
172
172
}
@@ -197,7 +197,7 @@ public static string GetErrorString(this PowerShell pwsh)
197
197
return sb . ToString ( ) ;
198
198
}
199
199
200
- private static void AddProfileMemberAndLoadIfExists ( this PowerShell pwsh , PSObject profileVariable , string profileName , string profilePath )
200
+ private static PowerShell AddProfileMemberAndLoadIfExists ( this PowerShell pwsh , PSObject profileVariable , string profileName , string profilePath )
201
201
{
202
202
profileVariable . Members . Add ( new PSNoteProperty ( profileName , profilePath ) ) ;
203
203
@@ -209,6 +209,8 @@ private static void AddProfileMemberAndLoadIfExists(this PowerShell pwsh, PSObje
209
209
210
210
pwsh . InvokeCommand ( psCommand ) ;
211
211
}
212
+
213
+ return pwsh ;
212
214
}
213
215
214
216
private static StringBuilder AddErrorString ( this StringBuilder sb , ErrorRecord error , int errorIndex )
0 commit comments