$CurrentDate = Get-Date $LogFile = "D:\Job\ExportScheduledTasks_$($CurrentDate.ToString("yyyyMMddHHmmss")).log" #导出过程日志的保存路径 Start-Transcript -Path $LogFile $BackupPath = "D:\Job\" #导出文件的保存路径 $ScheduledTaskPathRoot = "\NONEDI\" #job的路径 以'/'开始 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
powershell-批量导出Job
转载文章标签 powershell 文章分类 运维
-
powershell-批量创建ESXI主机账号
批量创建esxi主机账号,并加入到相应的组
powercli New-VMHostAccount New-VIPermission -
Powershell-批量设置域用户拨入权限
通过Powershell批量设置域用户的拨入属性
服务器 AD Powershel -
Powershell-批量清理DHCP BAD_ADDRESS地址
1.Powershell查询DHCP BAD_Address列表需求:DHCP服务器地址池频繁被Bad_Address垃圾请求打满;安全及网络同事在溯源排错过程中,需要及时清理垃圾地址信息,防止新用户无法正常获取IP地址信息;查询当前作用域信息:Get-DhcpServerv4Lease -ComputerName 10.78.0.226 -ScopeId 10.78.48.0查询当前地址池主机名
BAD_ADDRESS 批量清理DHCP无效地址池 DHCP Bad_address Remove-DhcpServerv4 DhcpServerv4Lease -
Powershell-基础:数组
数组中元素的删除和增加
数组 基础知识 powershell