diff --git a/CHANGELOG.md b/CHANGELOG.md index d7cca8c..b4d7acf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 1.5.1 - 2019.04.09 + +### Changed + +- Fix for scenario when there is no local and remote `get-scheduledtask`, added `invoke-SCHTasks`. + ## 1.5.0 - 2019.04.07 ### Added diff --git a/Find-TaskServiceUser.psd1 b/Find-TaskServiceUser.psd1 index b1a882d..a67d393 100644 Binary files a/Find-TaskServiceUser.psd1 and b/Find-TaskServiceUser.psd1 differ diff --git a/Find-TaskServiceUser.psm1 b/Find-TaskServiceUser.psm1 index ec22854..33e713d 100644 --- a/Find-TaskServiceUser.psm1 +++ b/Find-TaskServiceUser.psm1 @@ -16,7 +16,7 @@ Foreach($import in @($files)) } #check update -New-Variable -Name ModuleVersion -Value "1.5.0" +New-Variable -Name ModuleVersion -Value "1.5.1" $url = "https://api.github.com/repos/voytas75/Find-TaskServiceUser/releases/latest" $oldProtocol = [Net.ServicePointManager]::SecurityProtocol diff --git a/Find-TaskUser.ps1 b/Find-TaskUser.ps1 index 13da255..1035ef2 100644 --- a/Find-TaskUser.ps1 +++ b/Find-TaskUser.ps1 @@ -97,8 +97,14 @@ Function Find-TaskUser { } } catch { - Write-Verbose -Message $_ - return $null + Write-Verbose -Message "$server`: No remote command Get-ScheduledTask: $_" + Write-Verbose -Message "$server`: Switch to SCHTASK." + if ($Strict) { + $remote_schtask_data = Invoke-SCHTasks -server $server -user $user -Strict + } else { + $remote_schtask_data = Invoke-SCHTasks -server $server -user $user + } + return $remote_schtask_data } } #return Get-ScheduledTask -CimSession $server -ErrorAction stop | Where-Object {$_.author -match $user -or $_.Principal.userid -match $user} | Select-Object @{Name="Hostname"; Expression = {$_.PSComputerName}}, taskname, @{Name="Run As User"; Expression = {$_.Principal.userid}}, Author, URI