Guest Guest Posted July 30, 2022 Posted July 30, 2022 Hi all, Had an idea of when we image all Staff Workstations etc and when we say have a new image and we need to deploy it out then we would like to have a message sent to the logged on user saying “Your computer workstation needs to be imaged by IT Support, please contact [email protected] to set a time for imaging” Would this be achievable? I know that I could provably use something like NetSupport Notify but I don’t want to keep sending messages to computers, I want things automatically sent out for example every 30-40 days. Thanks
ThomL Posted August 1, 2022 Posted August 1, 2022 (edited) Use a GPO to configure a scheduled task that runs a PowerShell script when a user logs in (I'd think you could check if the user is in the correct group to make sure they are staff or the PC is in a group that requiring imaging) and then display the pop up message (all via the PowerShell Script). Or you could target the GPO to just the computers that require imaging. I've setup similar to prompt users to reboot devices when/if they have been online for prolonged periods of time. Edited August 1, 2022 by ThomL 1
Guest Guest Posted August 1, 2022 Posted August 1, 2022 Use a GPO to configure a scheduled task that runs a PowerShell script when a user logs in (I'd think you could check if the user is in the correct group to make sure they are staff or the PC is in a group that requiring imaging) and then display the pop up message (all via the PowerShell Script). Or you could target the GPO to just the computers that require imaging. I've setup similar to prompt users to reboot devices when/if they have been online for prolonged periods of time. Thanks, Yes going to write the script today so that info will come in handy. Thanks!
ThomL Posted August 1, 2022 Posted August 1, 2022 This might be helpful, or not... take a look. It displays the pop up to user stating the update is required, then gives the option to send the email now. If yes is clicked the script tries to open outlook and create an email with the to and subject prefilled and then the body prepopulated with some text for the user to complete, if outlook is not installed a mailto: uri is used to try and create the email (this is probably going to need some testing in your environment!) The script also creates a log (C:\temp\imagePopupLog.txt) that should log each time the script is runs and the users response to the pop up (again - probably best to test this in your environment) $itEmailAddr = "[email protected]" $emailSubject = "Image - $env:COMPUTERNAME" $emailBody = "Hello IT Support, My computer Workstation ($env:COMPUTERNAME) needs to be imaged. Can this be arranged for:" $date = Get-Date -Format "dd/MM/yyy HH:mm:ss" $popupLog = "C:\temp\imagePopupLog.txt" if (!(Test-Path $popupLog)){ New-Item $popupLog -Force } "$date - Popup Displayed to user" | Out-File -Encoding ascii -Append $popupLog $msgBoxInput = [system.Windows.MessageBox]::Show("Your computer workstation needs to be imaged by IT Support.`n`nPlease contact $itEmailAddr to set a time for imaging`n`nDo you wish to send this email now?","Update Required","YesNo","Error") switch ($msgBoxInput) { 'Yes' { $ol = New-Object -comObject Outlook.Application if ($null -ne $ol){ $mail = $ol.CreateItem(0) $mail.To = $itEmailAddr $mail.Subject = $emailSubject $mail.Body = $emailBody $mail.save()w $inspector = $mail.GetInspector $inspector.Display() } else { Start-Process "mailto:$itEmailAddr?subject=$emailSubject&Body=$emailBody" } } 'No' { [system.Windows.MessageBox]::Show("This update is required for security reason.`n`nPlease contact IT Support ASAP to arrange a time for the update.","Update Required","OK","Error") | out-null } } "$date - User selected: $msgBoxInput" | Out-File -Encoding ascii -Append $popupLog
Guest Guest Posted August 1, 2022 Posted August 1, 2022 This might be helpful, or not... take a look. It displays the pop up to user stating the update is required, then gives the option to send the email now. If yes is clicked the script tries to open outlook and create an email with the to and subject prefilled and then the body prepopulated with some text for the user to complete, if outlook is not installed a mailto: uri is used to try and create the email (this is probably going to need some testing in your environment!) The script also creates a log (C:\temp\imagePopupLog.txt) that should log each time the script is runs and the users response to the pop up (again - probably best to test this in your environment) $itEmailAddr = "[email protected]" $emailSubject = "Image - $env:COMPUTERNAME" $emailBody = "Hello IT Support, My computer Workstation ($env:COMPUTERNAME) needs to be imaged. Can this be arranged for:" $date = Get-Date -Format "dd/MM/yyy HH:mm:ss" $popupLog = "C:\temp\imagePopupLog.txt" if (!(Test-Path $popupLog)){ New-Item $popupLog -Force } "$date - Popup Displayed to user" | Out-File -Encoding ascii -Append $popupLog $msgBoxInput = [system.Windows.MessageBox]::Show("Your computer workstation needs to be imaged by IT Support.`n`nPlease contact $itEmailAddr to set a time for imaging`n`nDo you wish to send this email now?","Update Required","YesNo","Error") switch ($msgBoxInput) { 'Yes' { $ol = New-Object -comObject Outlook.Application if ($null -ne $ol){ $mail = $ol.CreateItem(0) $mail.To = $itEmailAddr $mail.Subject = $emailSubject $mail.Body = $emailBody $mail.save()w $inspector = $mail.GetInspector $inspector.Display() } else { Start-Process "mailto:$itEmailAddr?subject=$emailSubject&Body=$emailBody" } } 'No' { [system.Windows.MessageBox]::Show("This update is required for security reason.`n`nPlease contact IT Support ASAP to arrange a time for the update.","Update Required","OK","Error") | out-null } } "$date - User selected: $msgBoxInput" | Out-File -Encoding ascii -Append $popupLog That is amazing!! I will test this later on this afternoon when I’ve got some time on my hands. You are an absolute life saver I must say! I will let you know if I can get this to work. Thanks
Guest Guest Posted August 7, 2022 Posted August 7, 2022 Hey! Sorry for not replying sooner. Been very busy! What file type do I need to save it in, I have tried ps1 vbs .hta .html Can’t get it to work
ThomL Posted August 8, 2022 Posted August 8, 2022 Should work saved as a ps1, maybe open PowerShell ise from start menu, paste code in then save it and try it
Guest Guest Posted August 8, 2022 Posted August 8, 2022 Should work saved as a ps1, maybe open PowerShell ise from start menu, paste code in then save it and try it Thanks, Will give this a try
Sadiq_to222 Posted December 1, 2022 Posted December 1, 2022 Got it working! Had to get rid of this ($mail.save()w)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now