• [Powershell]导出指定的定时计划任务


    <#	
    	.NOTES
    	===========================================================================
    	 Created with: 	Visual Studio 2019
    	 Created on:   	2019/8/23 18:00
    	 Created by:   	Allen.Cai
    	 Organization: 	Allen.Cai
    	 Filename:     	export.ps1
    	===========================================================================
    	.DESCRIPTION
    		ERP job scheduled tasks export scripts.
    #>
    
    $CurrentDate = Get-Date
    $LogFile = "D:ackupTasksExportScheduledTasks_$($CurrentDate.ToString("yyyyMMddHHmmss")).log"
    Start-Transcript -Path $LogFile
    $BackupPath = "D:ackupTasks"
    $ScheduledTaskPathRoot = "MicrosoftERP"
    Write-Host "Start exporting of scheduled tasks."
    Get-ScheduledTask -TaskPath $ScheduledTaskPathRoot | ForEach-Object {
    	$taskPath = $_.TaskPath
    	$taskName = $_.TaskName
    	
    	New-Item -ItemType "directory" -Path "$BackupPath$taskPath" -ErrorAction SilentlyContinue
    	$taskInfo = Export-ScheduledTask -TaskName $taskName -TaskPath $taskPath
    	$taskInfo | Out-File "$BackupPath$taskPath$taskName.xml"
    }
    Write-Host "Saved file $BackupPath$TaskFolder$TaskName.xml"
    Stop-Transcript
    
  • 相关阅读:
    Explainable ML
    Fizz Buzz in tensorflow
    Tips for traing DNN (Adam,正则化,Dropout)
    深度学习 高数知识
    perror strerror使用方法
    posix信号量与互斥锁
    线程基本操作(一)
    system v共享内存与信号量综合
    shell统计当前文件夹下的文件个数、目录个数
    栈 c实现
  • 原文地址:https://www.cnblogs.com/VAllen/p/export-scheduled-tasks-of-powershell.html
Copyright © 2020-2023  润新知