Jump to content

Recommended Posts

Posted (edited)

The "powers that be", have in their infinite wisdom decided to switch to a 2 week timetable from September.

 

They have asked if I can display Week A or Week B on the desktop depending which week we are in.

 

Anyone ever done this or know of a "simple" way to do this?

 

Cheers

Edited by mdrabble
Posted

put 2 wallpapers somewhere on server called a.jpg & b.jpg. use gpo etc to set everyones wallpaper to c.jpg. on a server have a scheduled task that runs on sunday every 4 weeks that does copies a.jpg to c.jpg and another in the 2 weeks between that copies b.jpg to c.jpg

 

bit of a cludge but should work

Posted (edited)

Havn't got the solution (sorry) however its something very doable in python with the datetime library and OS or shutil depending on what you want:

 

Some cobbled together pseudopythonycode

#name of library
import [color=#0000FF][b]datetime[/b][/color]
import os

#getting current date
now [color=#666666]=[/color] datetime[color=#666666].[/color]datetime[color=#666666].[/color]now()
#current date to string 
now. day + now.month + now.year to now.string

#comparing string to csv/text file / array / list
Loop now.string to compare against lines in listA{

If now.string present in listA:
#rename file 
os.rename('filea' , 'fileb')
Else:

#rename file
os.rename('fileb' , 'filea')
}

Edited by cw222
  • Thanks 1
Posted
put 2 wallpapers somewhere on server called a.jpg & b.jpg. use gpo etc to set everyones wallpaper to c.jpg. on a server have a scheduled task that runs on sunday every 4 weeks that does copies a.jpg to c.jpg and another in the 2 weeks between that copies b.jpg to c.jpg

 

bit of a cludge but should work

 

Doing it this way, you'd probably need more detailed scheduling of the triggers to account for half terms, etc. where the A/B rotation skips an odd number of weeks (and then rework them all next year).

Posted (edited)

Think I have cracked it!

 

Powershell Code

 

#Get the Current Week
$today = Get-Date
$delta = $today.DayOfWeek.value__ - 1

#Import CSV
$CheckDate = $today.AddDays(-$delta).Date
$data = Import-Csv weeks.csv | 
   Where-Object {
       ($_."WeekDate" -as [DateTime]) -eq $CheckDate
   }

#Rename Wallpaper
if ($data.WeekAB -eq "Week A") {
 Copy-Item "\\server\netlogon\Wallpapers\Staff_WeekA.jpg" "\\server\netlogon\Wallpapers\Staff.jpg"
 Copy-Item "\\server\netlogon\Wallpapers\Student_WeekA.jpg" "\\server\netlogon\Wallpapers\Student.jpg"
   Write-Host "Week A"
}
else {
Copy-Item "\\server\netlogon\Wallpapers\Staff_WeekB.jpg" "\\server\netlogon\Wallpapers\Staff.jpg"
 Copy-Item "\\server\netlogon\Wallpapers\Student_WeekB.jpg" "\\server\netlogon\Wallpapers\Student.jpg"
 Write-Host "Week B"
}

 

 

Then just need to schedule a task to run once on a Monday at silly O'clock and the BGInfo does the rest!

Edited by mdrabble

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...