Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ private class MiscInfoGroup

#region Instance Data
private string _machineName = localMachineName; // we might need to have cmdlet work on another machine
private ProgressRecord _progress = null;

/// <summary>
/// Collection of property names from the Property parameter,
Expand Down Expand Up @@ -225,17 +224,10 @@ protected override void ProcessRecord()
/// </param>
private void UpdateProgress(string status)
{
if (_progress != null)
{
_progress.RecordType = ProgressRecordType.Completed;
WriteProgress(_progress);
}
ProgressRecord progress = new ProgressRecord(0, activity, status ?? ComputerResources.ProgressStatusCompleted);
progress.RecordType = status == null ? ProgressRecordType.Completed : ProgressRecordType.Processing;

if (status != null)
{
_progress = new ProgressRecord(0, activity, status);
WriteProgress(_progress);
}
WriteProgress(progress);
Comment thread
powercode marked this conversation as resolved.
Outdated
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,18 @@ try {
$computerInfo = Get-ComputerInfo
$computerInfo | Should -BeOfType 'Microsoft.PowerShell.Commands.ComputerInfo'
}

It "Verify progress records in Get-ComputerInfo" {
try {
$j = Start-Job { Get-ComputerInfo }
$j | Wait-Job
$j.ChildJobs[0].Progress | Should -HaveCount 9
$j.ChildJobs[0].Progress[-1].RecordType | Should -Be ([System.Management.Automation.ProgressRecordType]::Completed)
}
finally {
$j | Remove-Job
}
}
}

Describe "Tests for Get-ComputerInfo" -tags "Feature", "RequireAdminOnWindows" {
Expand Down