@@ -163,10 +163,10 @@ public static void LoadProfiles(this PowerShell pwsh, ProfilePathInfo profilePat
163163 {
164164 var profileVariable = new PSObject ( ) ;
165165
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 ) ;
170170
171171 pwsh . Runspace . SessionStateProxy . SetVariable ( "PROFILE" , profileVariable ) ;
172172 }
@@ -197,7 +197,7 @@ public static string GetErrorString(this PowerShell pwsh)
197197 return sb . ToString ( ) ;
198198 }
199199
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 )
201201 {
202202 profileVariable . Members . Add ( new PSNoteProperty ( profileName , profilePath ) ) ;
203203
@@ -209,6 +209,8 @@ private static void AddProfileMemberAndLoadIfExists(this PowerShell pwsh, PSObje
209209
210210 pwsh . InvokeCommand ( psCommand ) ;
211211 }
212+
213+ return pwsh ;
212214 }
213215
214216 private static StringBuilder AddErrorString ( this StringBuilder sb , ErrorRecord error , int errorIndex )
0 commit comments