zoukankan      html  css  js  c++  java
  • [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
    
  • 相关阅读:
    函数式语言(老师作业)
    session/cookie
    Linux根目录下各个目录的功能介绍
    Navicat12安装文件和破解补丁
    正则表达式验证示例
    RequestDispatcher接口示例
    hello2部分源码解析
    Introduction of Servlet Filter
    关于hello1中的web.xml解析
    Annotation解释
  • 原文地址:https://www.cnblogs.com/VAllen/p/export-scheduled-tasks-of-powershell.html
Copyright © 2011-2022 走看看