You could replace it all with:
function Get-ScheduledTask {
end {
SCHTASKS.EXE /QUERY /FO CSV | ConvertFrom-Csv
}
}
Comments: You are right, but the function has been written in this way for two reasons : 1- To be usable in any OS language (the split is used to retrieve status and taskname columns) 2- To interact with Stop and Start Functions (with the NoteProperty generated)
function Get-ScheduledTask {
end {
SCHTASKS.EXE /QUERY /FO CSV | ConvertFrom-Csv
}
}
Comments: You are right, but the function has been written in this way for two reasons : 1- To be usable in any OS language (the split is used to retrieve status and taskname columns) 2- To interact with Stop and Start Functions (with the NoteProperty generated)