Skip to content

Commit

Permalink
Merge pull request #57 from teamviewer/Warnings_Fix
Browse files Browse the repository at this point in the history
PSShouldProcess warning fix
  • Loading branch information
ChristianJ-TV authored Oct 17, 2023
2 parents 41a1bd5 + b231eaf commit 6c0ba45
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions Cmdlets/Public/Remove-TeamViewerAssignment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ function Remove-TeamViewerAssignment {
$cmd = 'teamviewer unassign'
$FilePath = 'sudo'
}
$process = Start-Process -FilePath $FilePath -ArgumentList $cmd -Wait -PassThru
$process.ExitCode | Resolve-AssignmentErrorCode
Set-Location $CurrentDirectory
if ($PSCmdlet.ShouldProcess($installationDirectory, 'Remove device assignment')) {
$process = Start-Process -FilePath $FilePath -ArgumentList $cmd -Wait -PassThru
$process.ExitCode | Resolve-AssignmentErrorCode
Set-Location $CurrentDirectory
}
}
else {
Write-Output 'TeamViewer is not installed.'
Expand Down
6 changes: 4 additions & 2 deletions Cmdlets/Public/Remove-TeamViewerCustomization.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ function Remove-TeamViewerCustomization {
$currentDirectory = Get-Location
Set-Location $installationDirectory
$cmd = 'customize --remove'
$process = Start-Process -FilePath TeamViewer.exe -ArgumentList $cmd -Wait -PassThru
$process.ExitCode | Resolve-CustomizationErrorCode
if ($PSCmdlet.ShouldProcess($installationDirectory, 'Remove Client Customization')) {
$process = Start-Process -FilePath TeamViewer.exe -ArgumentList $cmd -Wait -PassThru
$process.ExitCode | Resolve-CustomizationErrorCode
}
Set-Location $currentDirectory
}
else {
Expand Down

0 comments on commit 6c0ba45

Please sign in to comment.