Jump to content

ThomL

Members
  • Posts

    388
  • Joined

  • Last visited

Everything posted by ThomL

  1. Can you look at the source page for how it is loading the data and use the same approach rather than trying to somewhat scrape the data from the source page once it's loaded the data?
  2. 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
  3. 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.
  4. Looks like your problem - anything in the logs?
  5. content you're trying to install has been distributed to the DPs?
  6. Anything good in the client sccm logs? C:\Windows\CCM\Logs
  7. Just read that having the DP setup for prestaged content can cause this, is your DP setup this way? At the bottom of the page, past the boundary stuff - you've probably already tried this: https://www.prajwaldesai.com/application-installation-error-0x87d00607/ "Update – I got this information via Reddit. I am adding this to the post so that it will help others. According to the user, the issue was with prestaged content being enabled on the distribution point.This was discovered by looking at the content status of the application. It revealed that distribution manager was waiting for prestaged content. To fix this, go to the distribution point server properties. Click the General tab and uncheck the option Enable this distribution point for prestaged content. Click OK and redistribute the content and that should fix error 0x87D00607."
  8. Seems you can use vbCrLf, but the issue was possibly the way batch file was echoing to the temporary vbs file - from my testing you need to use the caret character as the batch escape character and ampersand to concatenate the vbCrLf to the text echoed to the temporary vbs file: ^& vbCrLf ^& This works for me, give it a go - I think you'll see the changes made a bit clearer than I've just tried to explain: echo a = msgbox("Off-site backup operation selected - ensure drive is connected to USB." ^& vbCrLf ^& vbCrLf ^& "Operation will take approx 1hr 30mins" ^& vbCrLf ^& "Please do not switch off or use the computer until verification message/email is received" ^& vbCrLf ^& vbCrLf ^& "Do you want to continue ?",vbInformation + vbyesno,"Event log") > "%temp%\popup.vbs echo WScript.Quit a >> "%temp%\popup.vbs" wscript.exe "%temp%\popup.vbs" set "exitcode=%errorlevel%" if errorlevel 7 goto no if errorlevel 6 goto yes :no echo msgbox "Operation cancelled",vbinformation,"Event log" > "%temp%\popup.vbs" wscript.exe "%temp%\popup.vbs" goto end :yes ----- Operation command goes in here ----- echo msgbox"Operation completed" ^& vbCrLf ^& vbCrLf ^& "Press OK to exit",vbinformation,"Event log" > "%temp%\popup.vbs" wscript.exe "%temp%\popup.vbs" :end
  9. Just came back to this - composed most of this reply before noticing Webman had already replied so I'm going to post it anyway! As Webman has said the issue was because the temp vbs script you create to display the messagebox wasn't returning an exit code. The batch script cannot access the variables from the temporary vbs file, so the batch script side of things was unable to access the answer to the messagebox displayed to users from the vbs file. This is a slightly different approach: line 1 creates the temp vbs file, adding a line to the file to display the messagebox and stores the users response in a variable called 'a', line 2 adds another line to the vba file that calls WScript.Quit and returns the content of variable 'a' as the exit code. line 3 runs the temporary vbs created in lines 1&2, line 4 then assigns the exit code from the temporary vbs to a variable that can be used by the batch script: errorlevel echo a = msgbox("Operation will be executed - Do you want to continue ?",vbInformation + vbyesno,"Event log") > "%temp%\popup.vbs" echo WScript.Quit a >> "%temp%\popup.vbs" wscript.exe "%temp%\popup.vbs" set "exitcode=%errorlevel%" if errorlevel 7 goto no if errorlevel 6 goto yes :no echo msgbox"Operation cancelled",vbinformation,"Event log" > "%temp%\popup.vbs" wscript.exe "%temp%\popup.vbs" goto end :yes ----- Operation command goes in here ----- echo msgbox"Operation completed - Press OK to exit",vbinformation,"Event log" > "%temp%\popup.vbs" wscript.exe "%temp%\popup.vbs" :end
  10. Does this have to run as a bat file? Could you use PowerShell or VBS?
  11. AB Tutor https://www.abtutor.com/
  12. https://www.eteach.com/job/it-support-officer-1253552 I'm looking for someone to help me with all things IT at Nailsea School. I've recently joined the school in the role of Network Manager and I'm looking to build a great IT support team - there is no immediate firefighting to be done, everything is stable. Any questions please feel free to send me a message or post a reply
  13. Nailsea School is looking to appoint an ICT Technician, take a look at Eteach for full details: https://www.eteach.com/job/ict-technician-1244362
  14. Had issues with posting the code to the forum, take another look at my previous post - I've updated it. EDIT! or here it is again with your column name and value added: Import-Csv File.csv | Select-[font=inherit]Object[/font] *,@{Name=[font=inherit]'[/font]role[font=inherit]'[/font];Expression={[font=inherit]'[/font]staff[font=inherit]'[/font]}} | Export-Csv NewFile.csv -NoTypeInformation
  15. Maybe something like this? Import-Csv File.csv | Select-[font=inherit]Object[/font] *,@{Name=[font=inherit]'New column'[/font];Expression={[font=inherit]'ValueForNewCol'[/font]}} | Export-Csv NewFile.csv -NoTypeInformation
  16. I'm not uninstalling the apps: The store and apps are being blocked on the device for the user session using a registry settings. There is a GPO to set this at a device level, however we need this restriction only in place for certain users and at the time could not use AppLocker. This is why the outlined solution was used - a script to perform a group membership lookup of the logged in user and then set the registry key that the GPO would set to block the store and apps if the account is an exam account. What is going to break (more than it fixes) for the exam accounts that receive the restriction of no access to the store or the store apps?
  17. Much simpler way of doing it! We were having issues with AppLocker and Windows version I believe, as well an needing to migrate SRPs to AppLocker and a few other issues. I'm sure there was a reason I had to do things the hard way...
  18. Calculator is a Microsoft Store app, for exams I resorted to blocking the Microsoft Store and all Microsoft Store apps. There is a Machine GPO that might be worth trying: However this didn't work for me - I need a per user approach to locking down the apps. Exam accounts need to login to any/all domain joined computers and not have access to the windows store apps like calculator/camera etc. To do this I have a PowerShell script that checks users group membership, if the user is a member of an exams security group then the registry setting to block the store/store apps is set to 1 (HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore\DisableStoreApps) and the apps are blocked. If the user isn't a member of the exams security group the registry is set to 0 acting a fail safe to make sure regular users have expected access to calculator/camera/etc. The script runs from a scheduled task that triggers at user login - users don't have the permissions needed to modify the registry so use of a scheduled task and an account with the correct level of access solves this. A single GPO is used to copy the script to clients and manage the scheduled task. The above has been working okay from my testing so far - the scheduled task doesn't trigger the instant a user logs in, so for the first minute or 2 the exam accounts still have account to calculator and other store apps. The exams team here sign the accounts in ahead of exam start times by at least 5 mins so the slight delay before the apps are blocked hasn't been an issue.
  19. I'll try this - does mean I'm going to need to code something to deploy printers to users, or rather allow staff to deploy printers as standard users; staff roam all over site with their laptops, previously Point and Print allowed them to add printers as they needed based on their physical location. Follow me printing would be much easier than this...
  20. Not yet - very annoying! I've tried preloading drivers but it seems to make no difference, I've just been reading this: which might explain why it's not working... I'm not sure. Still fighting to get this working with shared printers, I think i'm going slightly mad
  21. Just checked SCCM, we're deploying an older version with the exe: vlc-3.0.3-win32.exe /L=1033 /S https://wiki.videolan.org/Documentation:Installing_VLC/
  22. OP has multiple uplink ports at play to the Draytek, I think? so switch and draytek are connected with multiple cables - with each cable tagged to 1 vlan.
  23. Good catch, another tweaked version that might be worth trying: Function DisableTamper ($computer, $TamperCode) { #Enable WinRM service on remove computer, required for Invoke-Command. Get-Service -Name WinRM -ComputerName $computer | Start-service $session = New-PSSession -ComputerName $computer Invoke-Command -Session $session -ScriptBlock -ArgumentList $TamperCode { param($TamperCode) $TamperPath = "C:\Program Files\Sophos\Endpoint Defense\SEDcli.exe" $TamperArgs = "-TPoff $TamperCode" Start-Process -FilePath $TamperPath -ArgumentList $TamperArgs } } Function ExecuteZap ($computer){ #Enable WinRM service on remove computer, required for Invoke-Command. Get-Service -Name WinRM -ComputerName $computer | Start-service $session = New-PSSession -ComputerName $computer Invoke-Command -Session $session -ScriptBlock { $ZapPath = "c:\SophosZap.exe" $ZapArgs = "--confirm" Start-Process -FilePath $ZapPath -ArgumentList $ZapArgs } } Function RebootRequired($computer){ $SEL = get-content "\\$computer\C$\Users\User\AppData\Local\Temp\Sophos Windows Endpoint Zap log.txt" $amount = ($SEL.Count -1) if($SEL[$amount] -imatch "Outcome reboot required: 1"){ return $true }else{ return $false } } Function Zap($Computer, $TamperCode) { Write-host "$Computer - Now trying to disable Tamper" DisableTamper -computer $Computer -TamperCode $TamperCode Write-host "$Computer - Copying Sophos Zap" Copy "\\Server\Sophos\SophosZap.exe" "\\$Computer\c$\" Write-host "$Computer - Running SophosZap" ExecuteZap -computer $Computer Write-host "$Computer - Check if reboot required" if(RebootRequired -computer $Computer){ Write-Host "$Computer - Reboot Required" if (Restart-Computer -ComputerName $Computer -Wait -Timeout 90){ Write-Host "$Computer - Reboot Complete" }else{ Write-Host "$Computer - Reboot failed" } }else{ Write-Host "$Computer - Reboot not required" } Write-host "$Computer - Start remote service again" Get-Service -Name WinRM -ComputerName $computer | Start-service Write-host "$Computer - Next step to disable Tamper again" DisableTamper -computer $Computer -TamperCode $TamperCode Write-Host "$Computer - Running SophosZap Again" ExecuteZap -computer $Computer Write-host "$Computer - Check if reboot required" if(RebootRequired -computer $Computer){ Write-Host "$Computer - Reboot Required" }else{ Write-Host "$Computer - Reboot not required for SophosZap but rebooting to reinstall via GPO" } Remove-Item "\\$computer\c$\SophosZap.exe" Restart-Computer -ComputerName $Computer Write-Host "$computer - Sophos Zap Uninstall has finished" } $Info = Import-csv "D:\test\1.csv" Foreach ($entry in $Info) { Write-Host "################################################`r`n $($entry.name)" Zap -computer $entry.name -TamperCode $entry.Tamper Write-Host "$($entry.name) execution complete.`r`n################################################" }
  24. Messed about with the code, I don't have the ability to test - is this any good: Function DisableTamper ($computer, $TamperCode){ #Enable WinRM service on remove computer, required for Invoke-Command. Get-Service -Name WinRM -ComputerName $computer | Start-service $session = New-PSSession -ComputerName $computer Invoke-Command -Session $session -ScriptBlock { $TamperPath = "C:\Program Files\Sophos\Endpoint Defense\SEDcli.exe" $TamperArgs = "-TPoff $TamperCode" Start-Process -FilePath $TamperPath -ArgumentList $TamperArgs } } Function Zap($Computer, $TamperCode){ $reboot = 0 Write-host "$Computer - Now trying to disable Tamper" DisableTamper -computer $Computer -TamperCode $TamperCode Write-host "$Computer - Copying Sophos Zap" Copy "\\Server\Sophos\SophosZap.exe" "\\$Computer\c$\" Write-host "$Computer - Starting remote connection" $session = New-PSSession -ComputerName $computer Invoke-Command -Session $session -ScriptBlock { Write-host "$Computer - Running SophosZap" $ZapPath = "c:\SophosZap.exe" $ZapArgs = "--confirm" Start-Process -FilePath $ZapPath -ArgumentList $ZapArgs } Write-host "$Computer - Check log file for next step required (last line)" $SEL = get-content "\\$computer\C$\Users\User\AppData\Local\Temp\Sophos Windows Endpoint Zap log.txt" $amount = ($SEL.Count -1) if($SEL[$amount] -imatch "Outcome reboot required: 1"){ Write-Host "$Computer - Reboot Required" $reboot = 1 if (Restart-Computer -ComputerName $Computer -Wait -Timeout 45){ $reboot = 0 }else{ write-host "$Computer - Reboot failed" } }else{ Write-Host "$Computer - Reboot not required" $reboot = 0 } Write-host "$Computer - Start remote service again" Get-Service -Name WinRM -ComputerName $computer | Start-service Write-host "$Computer - Next step to disable Tamper again" DisableTamper -computer $Computer -TamperCode $TamperCode if (test-path -PathType Leaf -Path "\\$Computer\c$\SophosZap.exe"){ Write-host "$Computer - Starting remote connection" $session = New-PSSession -ComputerName $computer Invoke-Command -Session $session -ScriptBlock { write-host "$Computer - Running SophosZap Again" $ZapPath = "c:\SophosZap.exe" $ZapArgs = "--confirm" Start-Process -FilePath $ZapPath -ArgumentList $ZapArgs } } Write-host "$Computer - Check log file for next step required (last line)" $SEL = get-content "\\$computer\C$\Users\User\AppData\Local\Temp\Sophos Windows Endpoint Zap log.txt" $amount = ($SEL.Count -1) if($SEL[$amount] -imatch "Outcome reboot required: 1"){ Write-Host "$Computer - Reboot Required" }else{ Write-Host "$Computer - Reboot not required for SophosZap but rebooting to reinstall via GPO" } Remove-Item "\\$computer\c$\SophosZap.exe" Restart-Computer -ComputerName $Computer $reboot = 0 Write-Host "$computer - Sophos Zap Uninstall has has finished" } $Info = Import-csv "D:\test\1.csv"Foreach ($entry in $Info) { Write-Host "################################################`r`n $($entry.name)" Zap -computer $entry.name -TamperCode $entry.Tamper Write-Host "$($entry.name) Complete.`r`n################################################" }
  25. I tweaked a function found via google, seems to work from my testing - might be worth you trying?: function Get-StartMenuShortcuts($RootFolder){ $Shortcuts = Get-ChildItem -Recurse $RootFolder -Include *.lnk $Shell = New-Object -ComObject WScript.Shell foreach ($Shortcut in $Shortcuts){ $Properties = @{ ShortcutName = $Shortcut.Name; ShortcutFull = $Shortcut.FullName; ShortcutPath = $shortcut.DirectoryName Target = $Shell.CreateShortcut($Shortcut).targetpath } New-Object PSObject -Property $Properties } } $Output = Get-StartMenuShortcuts -RootFolder "Enter the path to root folder containing shortcuts here" $Output | select ShortcutName,Target
×
×
  • Create New...