22nd June 2021
Presentation on remote screen
Remote-presention with schedule task and Powershell
For this solution you need the following:
- AD-user (not domainadmin!!!) with lowest rights.
- AD-group populated by the user (above) who will access the folder and run the scheduletask. The group is also populated with the users who will update the presentation.
- GPO that will configure the schedule task on the client.
- A folderstructure according to my example down below
- A domainjoined computer with Micosoft powerpoint installed.
- Wifi or wired network
- A powershellscript (see below)
Folderstructure
Someware in your network you need to create a folderstructure that will hold the presentation, the script and where the script will save the logfile.
- Preferred name for system (Folder)
- Config.log (Logfile – will be created on first run)
- Presentation.ppsx (Presentation-file)
- Screenpresentation.ps1 (Script)
Security
There are three levels depending on how
- Low – you dont care anything about security – set all users everywhere – NOT RECOMMENDED!
- Normal – You create one AD-group and one ad-user (the user who runs the Schedule Task) and the users who will update the presentation.
- High – You create two AD-groups and one ad-user, The first AD-group has only read to share with presentation, and the other has modify.
You can choose if you want one account for all presentations or one for each. The GPO will be assigned to computeraccount.
Group-policy & Schedule Task
You need to create a GPO assigned to the OU where the computersticks or computers are located.
The schedule Task should be configured like this:
The commandline you should use are: “-executionpolicy Bypass \\server\share\ScreenPresentation.ps1”
Script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
############################################################################### #Defining remote and local path to folders with presentation $filename = 'Presentation.ppsx' $Place_to_present = 'Screenname' $RemotePath = "\\Server\Share\$Place_to_present" $LocalPath = "C:\ppt\" $logfile = "$RemotePath\config.log" # Function to write to logfile Function Write-Log { [CmdletBinding()] Param( [Parameter(Mandatory=$False)] [ValidateSet("INFO","WARN","ERROR","FATAL","DEBUG")] [String] $Level = "INFO", [Parameter(Mandatory=$True)] [string] $Message ) $Stamp = (Get-Date).toString("yyyy/MM/dd HH:mm:ss") $Line = "$Stamp $Level $Message" Add-Content $logfile -Value $Line } ############################################################################### # find local folder if(test-path $LocalPath) { write-log -Message 'Local folder exist' } else { write-log -Message 'Local folder missing, create new folder' New-Item -Path "c:\" -Name ppt -ItemType container } ############################################################################### #verify if powerpoint is running, and stop the process if((get-process "powerpnt" -ea SilentlyContinue) -eq $Null) { write-log -Message 'Powerpoint not running' } else { write-log -Message 'Powerpoint running, kill process' Stop-Process -processname "powerpnt" -force start-sleep 5 } ############################################################################### # verify if presentionfile exist if (test-path -Path $LocalPath\$filename) { write-log -Message 'Local presentationfile exist' #verify if ppsx-file is changed $remote = Get-ChildItem -Path $RemotePath -Filter "*.ppsx" | Get-FileHash $local = Get-ChildItem -Path $LocalPath -Filter "*.ppsx" | Get-FileHash #Compare if new in remote folder write-log -Message 'Comparing remote file with local file' if (Compare-Object -ReferenceObject $remote.Hash -DifferenceObject $local.Hash) { $RemFile = (Get-ChildItem $RemotePath -file) foreach ($file in $RemFile) { Copy-Item -Path $file.fullname -Destination $LocalPath -Recurse -force write-log -Message 'Remote File changed - copy new files' } } else { write-log -Message 'Remote File NOT changed' } } else { $RemFile = (Get-ChildItem $RemotePath -file) foreach ($file in $RemFile) { Copy-Item -Path $file.fullname -Destination $LocalPath -Recurse -force write-log -Message 'Remote file missing, copy from share' } } #path to local file $ppt = "$LocalPath\$filename" write-log -Message "Path to local file $ppt" #start the presentation again. write-log -Message 'Restart the presentation' Invoke-Item -Path $ppt |
You must be logged in to post a comment.