PowerShell script exchange
			
		
		
			
				
																			
								efd121 							 
						Enthusiast 			
		Posts:  73Liked:  6 times Joined:  Aug 07, 2015 8:45 pmFull Name:  David Engler
				Contact: 
				
			 
				
		 
		
						
					
																		
							
						
									
						Post 
					 
								by efd121  Jun 29, 2017 9:02 pm 
				
			
			
			
			I'm having trouble setting a new tape job to run on specific day of the month.  In this example I want the job to run on the third Sunday
When the job is created it schedules it for daily at 1:23 and when I change it to monthly at this time the only settings i see changed are OptionsDaily.Enabled changes from True to False and the OptionsMonthly.Enabled changes from False to True
I tried using the code below to make the same changes but the job is still scheduled to run daily.
Can anyone point me in the right direction?
Dave
Code: Select all 
$Weekend = "Third"
$DayToRun = "Sunday"
$MonthlyOptions = New-VBRMonthlyOptions -DayNumberInMonth $Weekend -DayOfWeek $DayToRun -Period 1:23
$SchedOptions = New-VBRBackupToTapeScheduleOptions -Type Monthly -MonthlyOptions $MonthlyOptions -Enabled
$Options = Get-VBRJobScheduleOptions -Job $TapeJob
$Options.OptionsDaily.Enabled = $false
$Options.OptionsMonthly.Enabled = $true
Set-VBRJobScheduleOptions -Options $Options -Job $TapeJob 
		 
				
		
		 
	 
				
		
		
			
				
																			
								veremin 							 
						Product Manager 			
		Posts:  20736Liked:  2403 times Joined:  Oct 26, 2012 3:28 pmFull Name:  Vladimir Eremin
				Contact: 
				
			 
				
		 
		
						
					
																		
							
						
									
						Post 
					 
								by veremin  Jun 30, 2017 8:38 am 
				
			
			
			
			Try the following script and see whether it meets your expectations:
 
Code: Select all 
$TapeJob = Get-VBRTapeJob -Name "Name of your backup to tape job"
$MonthlyOptions = New-VBRMonthlyOptions -DayOfWeek Sunday -DayNumberInMonth Third 
$ScheduleOptions = New-VBRBackupToTapeScheduleOptions -Type Monthly -MonthlyOptions $MonthlyOptions -Enabled
Set-VBRBackupToTapeJob -ScheduleOptions $ScheduleOptions -Job $TapeJob
Thanks.
 
		 
				
		
		 
	 
				
		
		
			
				
																			
								efd121 							 
						Enthusiast 			
		Posts:  73Liked:  6 times Joined:  Aug 07, 2015 8:45 pmFull Name:  David Engler
				Contact: 
				
			 
				
		 
		
						
					
																		
							
						
									
						Post 
					 
								by efd121  Jun 30, 2017 12:31 pm 
				
			
			
			
			Thanks I will give it a try next week when I'm back in the office 
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								veremin 							 
						Product Manager 			
		Posts:  20736Liked:  2403 times Joined:  Oct 26, 2012 3:28 pmFull Name:  Vladimir Eremin
				Contact: 
				
			 
				
		 
		
						
					
																		
							
						
									
						Post 
					 
								by veremin  Jun 30, 2017 12:53 pm 
				
			
			
			
			Ok, kindly, keep me updated. Thanks.
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								efd121 							 
						Enthusiast 			
		Posts:  73Liked:  6 times Joined:  Aug 07, 2015 8:45 pmFull Name:  David Engler
				Contact: 
				
			 
				
		 
		
						
					
																		
							
						
									
						Post 
					 
								by efd121  Jul 05, 2017 2:56 pm 
				
			
			
			
			I was able to update my script based on your input and its working as expected.  Thanks for the help.
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								veremin 							 
						Product Manager 			
		Posts:  20736Liked:  2403 times Joined:  Oct 26, 2012 3:28 pmFull Name:  Vladimir Eremin
				Contact: 
				
			 
				
		 
		
						
					
																			
						
									
						Post 
					 
								by veremin  Jul 05, 2017 2:57 pm 
				
			
			
			
			You're welcome. Glad to know that my input was helpful. If other questions arise, let me know.
			
			
									
						
										
						 
		 
				
		
		 
	 
	
	
	
		
		Users browsing this forum: No registered users and 10 guests