/// <summary>
        /// Gets an array of commands that can be run sequentially to set $profile and run the profile commands.
        /// </summary>
        /// <param name="shellId">The id identifying the host or shell used in profile file names.</param>
        /// <param name="useTestProfile">used from test not to overwrite the profile file names from development boxes</param>
        /// <returns>The commands used to set $profile.</returns>
        internal static PSCommand[] GetProfileCommands(string shellId, bool useTestProfile)
        {
            List <PSCommand> commands               = new List <PSCommand>();
            string           allUsersAllHosts       = HostUtilities.GetFullProfileFileName(null, false, useTestProfile);
            string           allUsersCurrentHost    = HostUtilities.GetFullProfileFileName(shellId, false, useTestProfile);
            string           currentUserAllHosts    = HostUtilities.GetFullProfileFileName(null, true, useTestProfile);
            string           currentUserCurrentHost = HostUtilities.GetFullProfileFileName(shellId, true, useTestProfile);
            PSObject         dollarProfile          = HostUtilities.GetDollarProfile(allUsersAllHosts, allUsersCurrentHost, currentUserAllHosts, currentUserCurrentHost);
            PSCommand        command = new PSCommand();

            command.AddCommand("set-variable");
            command.AddParameter("Name", "profile");
            command.AddParameter("Value", dollarProfile);
            command.AddParameter("Option", ScopedItemOptions.None);
            commands.Add(command);

            string[] profilePaths = new string[] { allUsersAllHosts, allUsersCurrentHost, currentUserAllHosts, currentUserCurrentHost };
            foreach (string profilePath in profilePaths)
            {
                if (!System.IO.File.Exists(profilePath))
                {
                    continue;
                }

                command = new PSCommand();
                command.AddCommand(profilePath, false);
                commands.Add(command);
            }

            return(commands.ToArray());
        }
 /// <summary>
 /// Gets an array of commands that can be run sequentially to set $profile and run the profile commands.
 /// </summary>
 /// <param name="shellId">The identifier of the host or shell used in profile file names.</param>
 /// <returns>The commands used to set $profile.</returns>
 internal static PSCommand[] GetProfileCommands(string shellId)
 {
     return(HostUtilities.GetProfileCommands(shellId, false));
 }
 /// <summary>
 /// Used to get all profile file names for the current or all hosts and for the current or all users.
 /// </summary>
 /// <param name="shellId">null for all hosts, not null for the specified host</param>
 /// <param name="forCurrentUser">false for all users, true for the current user.</param>
 /// <returns>The profile file name matching the parameters.</returns>
 internal static string GetFullProfileFileName(string shellId, bool forCurrentUser)
 {
     return(HostUtilities.GetFullProfileFileName(shellId, forCurrentUser, false));
 }