├── .github ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── question.yml │ ├── feature_request.yml │ └── bug_report.yml ├── README.md ├── PULL_REQUEST_TEMPLATE.md ├── CONTRIBUTING.md └── CODE_OF_CONDUCT.md ├── Framework ├── SubCall │ ├── Preparation │ │ ├── Custom │ │ │ └── readme.txt │ │ ├── 10_PrepBISF_PrinterLogic.ps1 │ │ ├── 10_PrepBISF_Splunk.ps1 │ │ ├── 50_PrepBISF_SecureBISFFolder.ps1 │ │ ├── 10_PrepBISF_uberAgent.ps1 │ │ ├── 10_PrepBISF_AppSense.ps1 │ │ ├── 10_PrepBISF_Heat.ps1 │ │ ├── 10_PrepBISF_IME.ps1 │ │ ├── 10_PrepBISF_Altiris.ps1 │ │ ├── 10_PrepBISF_FSLogix.ps1 │ │ ├── 10_PrepBISF_Tanium.ps1 │ │ ├── 10_PrepBISF_Turbo.ps1 │ │ ├── 10_PrepBISF_AV-KAVFS.ps1 │ │ ├── 10_PrepBISF_AV-EPC.ps1 │ │ ├── 10_PrepBISF_AV-F-Secure.ps1 │ │ ├── 10_PrepBISF_Empirum.ps1 │ │ ├── 10_PrepBISF_SCOM.ps1 │ │ ├── 10_PrepBISF_AV-WinDefend.ps1 │ │ ├── 10_PrepBISF_CMTrace.ps1 │ │ ├── 10_PrepBISF_vmOSOT.ps1 │ │ ├── 10_PrepBISF_AV-Sophos.ps1 │ │ ├── 10_PrepBISF_ZCM.ps1 │ │ ├── 10_PrepBISF_SCCM.ps1 │ │ ├── 10_PrepBISF_SetPageFile.ps1 │ │ ├── 80_PrepBISF_WriteCacheDisk.ps1 │ │ ├── 51_PrepBISF_DeleteRDSGracePeriod.ps1 │ │ ├── 10_PrepBISF_AppVClient.ps1 │ │ ├── 10_PrepBISF_AV-CylanceProtect.ps1 │ │ ├── 10_PrepBISF_AV-TM.ps1 │ │ ├── 10_PrepBISF_RES.ps1 │ │ └── 10_PrepBISF_AV-McAfee.ps1 │ ├── Global │ │ ├── BISF.ico │ │ ├── assembly │ │ │ ├── MahApps.Metro.dll │ │ │ └── System.Windows.Interactivity.dll │ │ └── BISF.psd1 │ ├── Personalization │ │ ├── Custom │ │ │ └── readme.txt │ │ ├── 10_PersBISF_Altiris.ps1 │ │ ├── 10_PersBISF_SCOM.ps1 │ │ ├── 10_PersBISF_Turbo.ps1 │ │ ├── 10_PersBISF_HydratePVS.ps1 │ │ ├── 10_PersBISF_SCCM.ps1 │ │ ├── 10_PersBISF_AV-Sophos.ps1 │ │ ├── 01_PersBISF_MS.ps1 │ │ ├── 10_PersBISF_AV-TM.ps1 │ │ ├── 10_PersBISF_FSLogix.ps1 │ │ ├── 10_PersBISF_ZCM.ps1 │ │ ├── 10_PersBISF_OfficeKMS.ps1 │ │ ├── 10_PersBISF_AV-SEP.ps1 │ │ ├── 99_PersBISF_StartUp.ps1 │ │ └── 02_PersBISF_CTX.ps1 │ └── Template │ │ └── BISF_TEMPLATE.ps1 └── PersBISF_Start.ps1 ├── README.md ├── .gitattributes ├── eucweb.website └── PrepareBaseImage.cmd /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/Custom/readme.txt: -------------------------------------------------------------------------------- 1 | put your custom scripts for the preparation during sealing here -------------------------------------------------------------------------------- /Framework/SubCall/Global/BISF.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUCweb/BIS-F/HEAD/Framework/SubCall/Global/BISF.ico -------------------------------------------------------------------------------- /Framework/SubCall/Global/assembly/MahApps.Metro.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUCweb/BIS-F/HEAD/Framework/SubCall/Global/assembly/MahApps.Metro.dll -------------------------------------------------------------------------------- /Framework/SubCall/Global/assembly/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUCweb/BIS-F/HEAD/Framework/SubCall/Global/assembly/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /Framework/SubCall/Personalization/Custom/readme.txt: -------------------------------------------------------------------------------- 1 | Put your custom scripts for the personalization phase here. These scripts will run during сomputer startup (triggered from BIS-F scheduled task) 2 | -------------------------------------------------------------------------------- /.github/README.md: -------------------------------------------------------------------------------- 1 | # BIS-F 2 | Base Image Script Framework (BIS-F) 3 | 4 | The Base Image Script Framework (BIS-F) is the perfect way to seal your Base Image. 5 | Whatever your environment has run Citrix XenApp, Citrix XenDesktop with PVS or MCS, Citrix AppLayering, VMware Horizon View, 6 | you must https://eucweb.com your Base Image before you can distribute this Image to multiple devices. 7 | If you install your Base Image from scratch or update them with new software, 8 | for the sealing process of your Base Image run this framework (preparation), 9 | it makes it also unique if you booting up your cloned device (personalization). -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BIS-F 7.1912 2 | 3 | 4 | Base Image Script Framework (BIS-F) - Bugs Bunny Release 5 | 6 | 7 | The Base Image Script Framework (BIS-F) is the perfect way to seal your Base Image. Whatever your environment has run Citrix XenApp, Citrix XenDesktop with PVS or MCS,  Citrix AppLayering, VMware Horizon View, Microosft WVD, Nutanix Xi Frame, Parallels RAS you must prepare your Base Image before you can distribute this Image to multiple devices. If you install your Base Image from scratch or update them with new software, for the sealing process of your Base Image run this framework (preparation), it makes it also unique if you booting up your cloned device (personalization). 8 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text=auto 3 | 4 | # Explicitly declare text files you want to always be normalized and converted 5 | # to native line endings on checkout. 6 | *.md text 7 | *.gitattributes text 8 | 9 | # Declare files that will always have CRLF line endings on checkout. 10 | *.ps1 text eol=crlf 11 | *.psm1 text eol=crlf 12 | *.psd1 text eol=crlf 13 | *.psc1 text eol=crlf 14 | *.ps1xml text eol=crlf 15 | *.clixml text eol=crlf 16 | *.xml text eol=crlf 17 | *.txt text eol=crlf 18 | 19 | # Denote all files that are truly binary and should not be modified. 20 | *.png binary 21 | *.jpg binary 22 | *.dll binary 23 | *.exe binary -------------------------------------------------------------------------------- /eucweb.website: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,2 3 | Prop4=31,edocs.eucweb.com � online documentation 4 | [InternetShortcut] 5 | IDList= 6 | URL=http://eucweb.com/docs 7 | IconFile=http://eucweb.com/wp-content/uploads/2017/09/cropped-cropped-cloud3-1-32x32.jpg 8 | IconIndex=1 9 | [{A7AF692E-098D-4C08-A225-D433CA835ED0}] 10 | Prop5=3,0 11 | Prop9=19,0 12 | Prop2=65,2C0000000200000003000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8D0000001A0000003D050000BD020000C9 13 | [{000214A0-0000-0000-C000-000000000046}.A] 14 | Prop4=31,eucweb.com - online documentation 15 | [{000214A0-0000-0000-C000-000000000046}.W] 16 | Prop4=31,eucweb.com - online documentation 17 | [{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}] 18 | Prop5=8,Microsoft.Website.9EBD6F41.A1BCFC0C -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.yml: -------------------------------------------------------------------------------- 1 | name: Question 2 | description: If you have a question, please fill out this form. 3 | title: "[Question]: " 4 | labels: "Type: Question" 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thank you for taking the time to fill out the question form! 10 | - type: textarea 11 | id: question 12 | attributes: 13 | label: Describe your question 14 | description: A clear and concise description of your question. 15 | validations: 16 | required: true 17 | - type: textarea 18 | id: screenshots 19 | attributes: 20 | label: Screenshots 21 | description: If applicable, add screenshots to help explain your question. 22 | validations: 23 | required: false 24 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Thanks for submitting a pull request! Please provide enough information so that others can review your pull request: 2 | 3 | **Summary** 4 | 5 | 6 | 7 | This PR fixes/implements the following **bugs/features** 8 | 9 | * [ ] Bug 1 10 | * [ ] Bug 2 11 | * [ ] Feature 1 12 | * [ ] Feature 2 13 | * [ ] Breaking changes 14 | 15 | 16 | 17 | Explain the **motivation** for making this change. What existing problem does the pull request solve? 18 | 19 | 20 | 21 | Does the code pass AppVeyor? 22 | * [ ] Yes 23 | 24 | 25 | 26 | **Closing issues** 27 | 28 | 29 | Fixes # 30 | -------------------------------------------------------------------------------- /Framework/SubCall/Personalization/10_PersBISF_Altiris.ps1: -------------------------------------------------------------------------------- 1 | 2 | <# 3 | .SYNOPSIS 4 | Personalize Altiris Agent for Image Managemement Software 5 | .DESCRIPTION 6 | If image is in shared mode the service will be started 7 | .EXAMPLE 8 | .NOTES 9 | Author: Matthias Schlimm 10 | Company: EUCWeb.com 11 | 12 | History: 13 | 14.10.2014 MS: function created 14 | 29.09.2015 MS: rewritten script with standard .SYNOPSIS, use central BISF function to configure service 15 | 16 | 17 | .LINK 18 | https://eucweb.com 19 | #> 20 | 21 | Begin { 22 | $script_path = $MyInvocation.MyCommand.Path 23 | $script_dir = Split-Path -Parent $script_path 24 | $script_name = [System.IO.Path]::GetFileName($script_path) 25 | $servicename = "Altiris Deployment Agent" 26 | } 27 | 28 | Process { 29 | 30 | $svc = Test-BISFService -ServiceName "$servicename" -ProductName "$servicename" 31 | IF ($svc) { 32 | Invoke-BISFService -ServiceName "$servicename" -Action Start -CheckDiskMode RW 33 | } 34 | } 35 | 36 | End { 37 | Add-BISFFinishLine 38 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_PrinterLogic.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare PrinterLogic PrinterInstaller 4 | .DESCRIPTION 5 | Delete PrinterLogic PrinterInstaller logfiles on Base Image 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History: 12 | 29.07.2017 MS: Script created 13 | 01.08.2017 JP: Fixed typo on line 36 14 | 15 | .LINK 16 | https://eucweb.com 17 | #> 18 | 19 | Begin { 20 | $Script_Path = $MyInvocation.MyCommand.Path 21 | $Script_Dir = Split-Path -Parent $script_path 22 | $Script_Name = [System.IO.Path]::GetFileName($script_path) 23 | $Product = "PrinterLogic PrinterInstaller Client Launcher" 24 | $ServiceName = "PrinterInstallerLauncher" 25 | $ProductPath = "$env:WinDir\Temp\PPP" 26 | } 27 | 28 | Process { 29 | 30 | $Svc = Test-BISFService -ServiceName "$ServiceName" -ProductName "$Product" 31 | If ($Svc -eq $true) { 32 | Write-BISFLog -Msg "Delete all files in $ProductPath" -ShowConsole -Color DarkCyan -SubMsg 33 | Remove-Item "$ProductPath\*" -Force -Recurse 34 | } 35 | } 36 | 37 | End { 38 | Add-BISFFinishLine 39 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_Splunk.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare Splunk Universal Fowarder for Image Management 4 | .DESCRIPTION 5 | Delete computer specific entries 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History: 12 | 15.12.2014 JP: Script created 13 | 06.02.2015 MS: review script 14 | 01.10.2015 MS: rewritten script with standard .SYNOPSIS, use central BISF function to configure service 15 | 28.05.2018 MS: Bugfix 41: Set SplunkForwarder to StartType Automatic 16 | 17 | .LINK 18 | https://eucweb.com 19 | #> 20 | 21 | Begin { 22 | $script_path = $MyInvocation.MyCommand.Path 23 | $script_dir = Split-Path -Parent $script_path 24 | $script_name = [System.IO.Path]::GetFileName($script_path) 25 | $Product = "Splunk Universal Forwarder" 26 | $product_path = "${env:ProgramFiles}\SplunkUniversalForwarder\bin" 27 | $servicename = "SplunkForwarder" 28 | } 29 | 30 | Process { 31 | 32 | $svc = Test-BISFService -ServiceName "$servicename" -ProductName "$product" 33 | IF ($svc -eq $true) { 34 | Invoke-BISFService -ServiceName "$servicename" -Action Stop -StartType Automatic 35 | Write-BISFLog -Msg "Clear $Product config" 36 | & Start-Process -FilePath "$product_path\splunk.exe" -ArgumentList "clone-prep-clear-config" -Wait -WindowStyle Hidden 37 | } 38 | } 39 | 40 | End { 41 | Add-BISFFinishLine 42 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/50_PrepBISF_SecureBISFFolder.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Secure BISF Folder for user access 4 | .DESCRIPTION 5 | Prevent access for users to the BISF Rootfolder 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History: 12 | 28.05.2015 MB: Script created 13 | 12.08.2015 MS: integrated in BIS-F 14 | 01.10.2015 MS: rewritten script with standard 15 | 16 | .LINK 17 | https://eucweb.com 18 | #> 19 | 20 | Begin { 21 | $RootBISFFolder = Split-Path (Split-Path $LIC_BISF_MAIN_PersScript) 22 | $Product = $FrameworkName 23 | $script_path = $MyInvocation.MyCommand.Path 24 | $script_dir = Split-Path -Parent $script_path 25 | $script_name = [System.IO.Path]::GetFileName($script_path) 26 | } 27 | 28 | Process { 29 | 30 | IF ((Test-Path $RootBISFFolder) -eq $true) { 31 | Write-BISFLog -Msg "$Product installed, securing folder" -ShowConsole -Color Cyan 32 | try { 33 | $result = Invoke-Expression -command "icacls.exe `"$RootBISFFolder`" /inheritance:d /remove users" 34 | Write-BISFLog -Msg "User access on the folder `"$RootBISFFolder`" is removed." -ShowConsole -Color DarkCyan -SubMsg 35 | } 36 | catch { 37 | Write-Log -BISFMsg "Error removing User access on the folder `"$RootBISFFolder`". The output of the action is: $result" -Type W -SubMsg 38 | } 39 | } 40 | ELSE { 41 | Write-Log -Msg "$Product NOT installed" -Type E 42 | 43 | } 44 | 45 | } 46 | 47 | End { 48 | Add-BISFFinishLine 49 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_uberAgent.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare uberAgent for Image Management 4 | .DESCRIPTION 5 | Delete computer specific entries 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History: 12 | 26.04.2016 MZ: Script created 13 | 09.01.2017 MS: Implemented in BIS-F, thx to Marco Zimmermann (MZ) 14 | 12.01.2017 MS: Added IF (Test-Path $reg_Product_Key) before continue 15 | 18.01.2017 JP: Fixed typo in product variable 16 | 28.01.2017 MS: typo in $PSScriptName = [System.IO.Path]::GetFileName($PSScriptFullName) 17 | 03.10.2019 MS: HF 138 - din't change the startuptype to automatic 18 | 19 | .LINK 20 | https://eucweb.com 21 | #> 22 | 23 | Begin { 24 | $PSScriptFullName = $MyInvocation.MyCommand.Path 25 | $PSScriptRoot = Split-Path -Parent $PSScriptFullName 26 | $PSScriptName = [System.IO.Path]::GetFileName($PSScriptFullName) 27 | 28 | $Product = "uberAgent" 29 | $servicename = "uberAgentSvc" 30 | $reg_Product_Key = "$HKLM_sw\vast limits\uberAgent" 31 | } 32 | 33 | Process { 34 | 35 | $svc = Test-BISFService -ServiceName $servicename -ProductName $product 36 | IF ($svc) { 37 | Invoke-BISFService -ServiceName $servicename -Action Stop #-StartType automatic # -> HF 138 comment out 38 | Write-BISFLog -Msg Clear $Product config 39 | IF (Test-Path $reg_Product_Key) { 40 | & Remove-Item '$reg_Product_Key' -Recurse -Force 41 | Write-BISFLog -Msg "Clean $Product registry $reg_Product_Key deleted" 42 | } 43 | } 44 | } 45 | 46 | End { 47 | Add-BISFFinishLine 48 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_AppSense.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare AppSense Agent for Image Management 4 | .DESCRIPTION 5 | Lookup for the AppSense Client Communications Agent and prepare the agent for imaging 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History 12 | 22.03.2016 MS: Script created 13 | 28.06.2017 MS: Bugfix 186 - AppSense Product Path - thx to Matthias Kowalkowski 14 | 18.02.2020 JK: Fixed Log output spelling 15 | 16 | .LINK 17 | https://eucweb.com 18 | #> 19 | 20 | Begin { 21 | $script_path = $MyInvocation.MyCommand.Path 22 | $script_dir = Split-Path -Parent $script_path 23 | $script_name = [System.IO.Path]::GetFileName($script_path) 24 | $Product = "AppSense" 25 | $product_path = "${env:ProgramFiles}\AppSense\Management Center\Communications Agent" 26 | $PrepApp = "CcaCmd.exe" 27 | $servicename = "AppSense Client Communications Agent" 28 | } 29 | 30 | Process { 31 | 32 | $svc = Test-BISFService -ServiceName "$servicename" -ProductName "$product" 33 | IF ($svc -eq $true) { 34 | Write-BISFLog -Msg "Preperaring $Product for Imaging" -ShowConsole -Color DarkCyan -SubMsg 35 | IF (Test-Path ("$product_path\$PrepApp") -PathType Leaf ) { 36 | Write-BISFLog -Msg "Preparing $Product for Imaging " 37 | & Start-Process -FilePath "$product_path\$PrepApp" -ArgumentList "/imageprep" -Wait 38 | } 39 | ELSE { 40 | Write-BISFLog -Msg "$product_path\$PrepApp does not exist. Image Preparation could not be performed!" -Type E -SubMsg 41 | } 42 | 43 | } 44 | } 45 | 46 | End { 47 | Add-BISFFinishLine 48 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: Feature request 2 | description: Suggest an idea for this project 3 | title: "[Feature request]: " 4 | labels: "Type: Enhancement" 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thank you for taking the time to fill out this feature form! 10 | - type: textarea 11 | id: feature 12 | attributes: 13 | label: Is your feature request related to a problem? Please describe. 14 | description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 15 | validations: 16 | required: true 17 | - type: textarea 18 | id: solution 19 | attributes: 20 | label: Describe the solution you'd like 21 | description: A clear and concise description of what you want to happen. 22 | validations: 23 | required: true 24 | - type: textarea 25 | id: alternatives 26 | attributes: 27 | label: Describe alternatives you've considered 28 | description: A clear and concise description of any alternative solutions or features you've considered. 29 | validations: 30 | required: true 31 | - type: textarea 32 | id: screenshots 33 | attributes: 34 | label: Screenshots 35 | description: If applicable, add screenshots to help explain your problem. 36 | validations: 37 | required: false 38 | - type: textarea 39 | id: context 40 | attributes: 41 | label: Additional context 42 | description: Add any other context about the problem here. This will be automatically formatted into code, so no need for backticks. 43 | render: shell 44 | validations: 45 | required: false 46 | -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_Heat.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Prepare Heat DSM Agent for Imaging Management 4 | .DESCRIPTION 5 | Lookup for the Heat DSM Core Service and prepare the Agent for Imaging 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History: 12 | 17.02.2015 MS: Script created 13 | 30.09.2015 MS: Rewritten script with standard .SYNOPSIS, use central BISF function to configure service 14 | 04.11.2015 MS: Syntax error -> replace WriteBISF-Log with Write-BISFLog 15 | 10.12.2015 MS: Change Productname from "Frantrange DSM " to "Heat DSM" 16 | 18.02.2020 JK: Fixed Log output spelling 17 | 18 | .LINK 19 | https://eucweb.com 20 | #> 21 | 22 | Begin { 23 | $script_path = $MyInvocation.MyCommand.Path 24 | $script_dir = Split-Path -Parent $script_path 25 | $script_name = [System.IO.Path]::GetFileName($script_path) 26 | $Product = "Heat DSM" 27 | $product_path = "$ProgramFilesx86\NetInst" 28 | $PrepApp = "niprep.exe" 29 | $servicename = "esiCore" 30 | } 31 | 32 | Process { 33 | 34 | $svc = Test-BISFService -ServiceName "$servicename" -ProductName "$product" 35 | IF ($svc -eq $true) { 36 | Write-BISFLog -Msg "Preparing $Product for Imaging" -ShowConsole -Color DarkCyan -SubMsg 37 | IF (Test-Path ("$product_path\$PrepApp") -PathType Leaf ) { 38 | Write-BISFLog -Msg "Preparing $Product for Imaging " 39 | & Start-Process -FilePath "$product_path\$PrepApp" -ArgumentList "/r" -Wait 40 | } 41 | ELSE { 42 | Write-BISFLog -Msg "$product_path\$PrepApp does not exists. Image Preperation could not be performed!" -Type E -SubMsg 43 | } 44 | 45 | } 46 | } 47 | 48 | End { 49 | Add-BISFFinishLine 50 | } -------------------------------------------------------------------------------- /Framework/SubCall/Template/BISF_TEMPLATE.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | 4 | 5 | .DESCRIPTION 6 | 7 | 8 | .PARAMETER 9 | 10 | 11 | .INPUTS 12 | 13 | 14 | .OUTPUTS 15 | .log> 16 | 17 | 18 | .NOTES 19 | 20 | Author: 21 | 22 | History: 23 | dd.mm.yyy - : Initial script 24 | 25 | .Link 26 | https://eucweb.com 27 | #> 28 | 29 | Begin { 30 | # define environment 31 | # Setting default variables ($PSScriptroot/$logfile/$PSCommand,$PSScriptFullname/$scriptlibrary/LogFileName) independent on running script from console or ISE and the powershell version. 32 | If ($($host.name) -like "* ISE *") { 33 | # Running script from Windows Powershell ISE 34 | $PSScriptFullName = $psise.CurrentFile.FullPath.ToLower() 35 | $PSCommand = (Get-PSCallStack).InvocationInfo.MyCommand.Definition 36 | } 37 | ELSE { 38 | $PSScriptFullName = $MyInvocation.MyCommand.Definition.ToLower() 39 | $PSCommand = $MyInvocation.Line 40 | } 41 | [string]$PSScriptName = (Split-Path $PSScriptFullName -leaf).ToLower() 42 | If (($PSScriptRoot -eq "") -or ($PSScriptRoot -eq $null)) { [string]$PSScriptRoot = (Split-Path $PSScriptFullName).ToLower() } 43 | } 44 | 45 | Process { 46 | #################################################################### 47 | ####### functions ##### 48 | #################################################################### 49 | 50 | 51 | 52 | ####### end functions ##### 53 | 54 | 55 | #### Main Program 56 | 57 | } 58 | 59 | End { 60 | Add-BISFFinishLine 61 | } 62 | -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_IME.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding(SupportsShouldProcess = $true)] 2 | param( 3 | ) 4 | <# 5 | .SYNOPSIS 6 | Delete Office 2010 IME Keyboards from Autorun 7 | .DESCRIPTION 8 | .EXAMPLE 9 | .NOTES 10 | Author: Benjamin Ruoff 11 | Company: EUCWeb.com 12 | 13 | History 14 | 26.10.2015 MS: Script created 15 | 16 | .LINK 17 | https://eucweb.com 18 | #> 19 | 20 | Begin { 21 | 22 | #################################################################### 23 | # define environment 24 | 25 | $script_path = $MyInvocation.MyCommand.Path 26 | $script_dir = Split-Path -Parent $script_path 27 | $script_name = [System.IO.Path]::GetFileName($script_path) 28 | 29 | # Product specified 30 | $Product = "Office IME Languages Clean-up" 31 | [array]$reg_IME_string = "$hklm_software\Microsoft\Windows\CurrentVersion\Run" 32 | [array]$reg_IME_string += "$hklm_software\Wow6432Node\Microsoft\Windows\CurrentVersion\Run" 33 | 34 | [array]$reg_IME_name = "IME14 JPN Setup" 35 | [array]$reg_IME_name += "IME14 KOR Setup" 36 | [array]$reg_IME_name += "IME14 CHS Setup" 37 | [array]$reg_IME_name += "IME14 CHT Setup" 38 | 39 | #################################################################### 40 | 41 | function deleteOfficeIME { 42 | # Delete specified Data 43 | foreach ($path in $reg_IME_string) { 44 | foreach ($key in $reg_IME_name) { 45 | Write-BISFLog -Msg "delete specified registry items in $($path)..." 46 | Write-BISFLog -Msg "delete $key" 47 | Remove-ItemProperty -Path $path -Name $key -ErrorAction SilentlyContinue 48 | } 49 | 50 | } 51 | 52 | } 53 | 54 | #################################################################### 55 | } 56 | 57 | Process { 58 | 59 | #### Main Program 60 | deleteOfficeIME 61 | 62 | } 63 | 64 | End { 65 | Add-BISFFinishLine 66 | } -------------------------------------------------------------------------------- /Framework/SubCall/Personalization/10_PersBISF_SCOM.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Personalize SCOM Client for Image Managemement Software 4 | .DESCRIPTION 5 | 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History: 12 | 17.11.2014 MS: Script created for OpsMagr2k7 13 | 06.10.2015 MS: rewritten script with standard .SYNOPSIS, use central BISF function to configure service 14 | 04.03.2016 MS: fixed issue SCOM service would be start on every Image Mode if installed 15 | 19.10.2018 MS: Bugfix 72: MCS Deployment: SCOM Agent - creates OpsStateDir in C: drive 16 | 18.02.2020 JK: Fixed Log output spelling 17 | 18 | .LINK 19 | https://eucweb.com 20 | #> 21 | 22 | Begin { 23 | $OpsStateDir = "$PVSDiskDrive\OpsStateDir" 24 | $servicename = "HealthService" 25 | $Product = "Microsoft SCOM Agent" 26 | $script_path = $MyInvocation.MyCommand.Path 27 | $script_dir = Split-Path -Parent $script_path 28 | $script_name = [System.IO.Path]::GetFileName($script_path) 29 | } 30 | 31 | Process { 32 | 33 | $svc = Test-BISFService -ServiceName "$servicename" -ProductName "$Product" 34 | IF ($svc) { 35 | $OpsStateDir = (Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\services\$servicename\Parameters")."State Directory" 36 | IF ($returnTestPVSSoftware -eq "true") { 37 | Write-BISFLog -Msg "Citrix PVS Target Device detected, Set StateDirectory to Path $OpsStateDir" 38 | If (!(Test-Path -Path $OpsStateDir)) { 39 | Write-BISFLog -Msg "Create Directory $OpsStateDir" 40 | New-Item -path "$OpsStateDir" -ItemType Directory -Force 41 | } 42 | } 43 | ELSE { 44 | Write-BISFLog -Msg "Citrix PVS Target Device NOT detected, leaving StateDirectory on original path $OpsStateDir" 45 | } 46 | Invoke-BISFService -ServiceName "$servicename" -Action Start 47 | } 48 | } 49 | 50 | End { 51 | Add-BISFFinishLine 52 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_Altiris.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare Altiris Agent for Image Management 4 | .DESCRIPTION 5 | Reconfigure the Altiris Deployment Agent. If Service is installed, it would be stopped and set to manual startup 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History: 12 | 14.10.2014 MS: function created 13 | 02.09.2015 MS: rewritten script with standard .SYNOPSIS, use central BISF function to configure service 14 | 09.11.2016 MS: add preparation for Altiris Inventory Agent 15 | 12.07.2017 FF: Create $RegKeys as an array (was a hashtable before) 16 | 18.02.2020 JK: Fixed Log output spelling 17 | 18 | .LINK 19 | https://eucweb.com 20 | #> 21 | 22 | 23 | Begin { 24 | $script_path = $MyInvocation.MyCommand.Path 25 | $script_dir = Split-Path -Parent $script_path 26 | $script_name = [System.IO.Path]::GetFileName($script_path) 27 | $servicename1 = "Altiris Deployment Agent" 28 | 29 | $servicename2 = "AeXNSClient" 30 | $productname2 = "Altiris Inventory Agent" 31 | $RegKeys = @("HKLM:\SOFTWARE\Altiris\Altiris Agent", "HKLM:\SOFTWARE\Altiris\eXpress", "HKLM:\SOFTWARE\Altiris\eXpress\NS Client") 32 | 33 | } 34 | 35 | Process { 36 | 37 | $svc1 = Test-BISFService -ServiceName "$servicename1" -ProductName "$servicename1" 38 | IF ($svc1 -eq $true) { 39 | Invoke-BISFService -ServiceName "$servicename1" -Action Stop -StartType manual 40 | } 41 | 42 | 43 | $svc2 = Test-BISFService -ServiceName "$servicename2" -ProductName "$productname2" 44 | IF ($svc2 -eq $true) { 45 | Invoke-BISFService -ServiceName "$servicename2" -Action Stop -StartType manual 46 | foreach ($RegKey in $RegKeys) { 47 | Try { 48 | Remove-ItemProperty -Path $Regkey -Name "MachineGUID" -ErrorAction Stop 49 | Write-BISFLog -Msg "$($RegKey) Successfully deleted" -showconsole -Color DarkCyan -SubMsg 50 | } 51 | catch [System.Security.SecurityException] { 52 | Write-BISFLog -Msg "Permission Denied for $($RegKey)" -ForegroundColor Red -SubMsg 53 | } 54 | } 55 | } 56 | 57 | } 58 | 59 | End { 60 | Add-BISFFinishLine 61 | } -------------------------------------------------------------------------------- /Framework/SubCall/Personalization/10_PersBISF_Turbo.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Personalize Turbo.net Applications for Image Management 4 | .DESCRIPTION 5 | Update the turbo subscription 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History: 12 | 22.03.2016 MS: Script created 13 | 18.02.2020 JK: Fixed Log output spelling 14 | 15 | .LINK 16 | https://eucweb.com 17 | #> 18 | 19 | Begin { 20 | 21 | #################################################################### 22 | # define environment 23 | $PSScriptFullName = $MyInvocation.MyCommand.Path 24 | $PSScriptRoot = Split-Path -Parent $PSScriptFullName 25 | $PSScriptName = [System.IO.Path]::GetFileName($PSScriptFullName) 26 | 27 | #product specified 28 | $Product = "Turbo.net" 29 | $ProductInstPath = "$ProgramFilesx86\Spoon\Cmd\Turbo.exe" 30 | $Tas 31 | 32 | } 33 | 34 | Process { 35 | 36 | #################################################################### 37 | ####### functions ##### 38 | #################################################################### 39 | 40 | function Invoke-TurboSupscriptionUpdate { 41 | $varTB = Get-Variable -Name LIC_BISF_TurboRun -ValueOnly 42 | Write-BISFLog -Msg "The Turbo Subscription Update will be set to the Value $($varTB) in the registry" 43 | 44 | IF ($varTB -eq "YES") { 45 | Write-BISFLog -Msg "Running Turbo Update Subscription Now" 46 | Invoke-Expression (Get-ScheduledTask -TaskPath "\turbo-net\" | Start-ScheduledTask) 47 | Show-ProgressBar -CheckProcess "Turbo" -ActivityText "Running Turbo Subscription Update" 48 | } 49 | } 50 | 51 | #################################################################### 52 | ####### end functions ##### 53 | #################################################################### 54 | 55 | #### Main Program 56 | 57 | IF (Test-Path ("$ProductInstPath") -PathType Leaf) { 58 | Write-BISFLog -Msg "Product $Product installed" -ShowConsole -Color Cyan 59 | Invoke-TurboSupscriptionUpdate 60 | 61 | } 62 | ELSE { 63 | Write-BISFLog -Msg "Product $Product not installed" 64 | } 65 | } 66 | 67 | End { 68 | Add-BISFFinishLine 69 | } -------------------------------------------------------------------------------- /Framework/SubCall/Personalization/10_PersBISF_HydratePVS.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .Synopsis 3 | Enables pre-caching of files for PVS systems 4 | .Description 5 | Enables pre-caching of files for PVS systems 6 | Tested on Server 2019 7 | .EXAMPLE 8 | .Inputs 9 | .Outputs 10 | .NOTES 11 | 12 | History 13 | 2019.08.16 TT: Script created 14 | 18.08.2019 MS: integrate into BIS-F 15 | 03.02.2020 MS: HF 201 - Hydration not startig if configured 16 | 23.05.2020 MS: HF 231 - Skipping file precache if vDisk is in private Mode 17 | .Link 18 | https://github.com/EUCweb/BIS-F/issues/129 19 | 20 | .Link 21 | https://eucweb.com 22 | #> 23 | 24 | Begin { 25 | $script_path = $MyInvocation.MyCommand.Path 26 | $script_dir = Split-Path -Parent $script_path 27 | $script_name = [System.IO.Path]::GetFileName($script_path) 28 | $PathsToCache = $LIC_BISF_CLI_PVSHydration_Paths 29 | $ExtensionsToCache = $LIC_BISF_CLI_PVSHydration_Extensions 30 | } 31 | 32 | Process { 33 | 34 | 35 | function FileToCache ($File) { 36 | #Write-BISFLog -Msg "Caching File : $File" -ShowConsole -Color Cyan 37 | $hydratedFile = [System.IO.File]::ReadAllBytes($File) 38 | } 39 | 40 | $WriteCacheType = Get-BISFPVSWriteCacheType 41 | if ($WriteCacheType -eq 0) { # private Mode 42 | Write-BISFLog -Msg "PVS vDisk is in Private Mode. Skipping file precache." -ShowConsole -Color Yellow 43 | Return 44 | } 45 | 46 | if (-not(Test-BISFPVSSoftware)) { 47 | Write-BISFLog -Msg "PVS Software not found. Skipping file precache." -ShowConsole -Color Yellow 48 | Return 49 | } 50 | if (-not($LIC_BISF_CLI_PVSHydration -eq "YES")) { 51 | Write-BISFLog -Msg "File precache configuration not found. Skipping." -ShowConsole -Color Yellow 52 | Return 53 | } 54 | 55 | foreach ($Path in ($PathsToCache.split("|"))) { 56 | Write-BISFLog -Msg "Caching files with extensions $ExtensionsToCache in $Path" -ShowConsole -Color Cyan 57 | foreach ($File in (Get-ChildItem -Path $Path -Recurse -File -Include $ExtensionsToCache.Split(","))) { 58 | FileToCache -File $File 59 | } 60 | } 61 | } 62 | 63 | End { 64 | Add-BISFFinishLine 65 | } 66 | -------------------------------------------------------------------------------- /Framework/SubCall/Personalization/10_PersBISF_SCCM.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Personalize SCCM Client for Image Managemement Software 4 | .Description 5 | 6 | .EXAMPLE 7 | .Inputs 8 | .Outputs 9 | .NOTES 10 | Author: Matthias Schlimm 11 | Company: Login Consultants Germany GmbH 12 | 13 | History 14 | Last Change: 26.03.2014 MS: Script created for SCCM 2012 R2 15 | Last Change: 14.05.2014 MS: BUG code-error certstore SMS not deleted > & Invoke-Expression 'certutil -delstore SMS "SMS"' 16 | Last Change: 11.08.2014 MS: remove Write-Host change to Write-Log 17 | Last Change: 13.08.2014 MS: remove $logfile = Set-logFile, it would be used in the 10_XX_LIB_Config.ps1 Script only 18 | Last Change: 19.02.2015 MS: error handling 19 | Last Change: 01.10.2015 MS: rewritten script with standard .SYNOPSIS, use central BISF function to configure service 20 | .Link 21 | #> 22 | 23 | Begin { 24 | $ccm_path = "C:\Windows\CCM" 25 | $PSScriptFullName = $MyInvocation.MyCommand.Path 26 | $PSScriptRoot = Split-Path -Parent $PSScriptFullName 27 | $PSScriptName = [System.IO.Path]::GetFileName($PSScriptFullName) 28 | $Product = "Microsoft SCCM Agent" 29 | $servicename = "CcmExec" 30 | } 31 | 32 | Process 33 | { 34 | function deleteCCMData 35 | { 36 | # remove existing certificates from SMS store 37 | & Invoke-Expression 'certutil -delstore SMS "SMS"' 38 | 39 | # reset site key information 40 | & Invoke-Expression "WMIC /NAMESPACE:\\root\ccm\locationservices Path TrustedRootKey DELETE" 41 | 42 | #Delete Smscfg.ini 43 | Remove-Item -Path ${env:WinDir}'\SMSCFG.ini' -Force -ErrorAction SilentlyContinue 44 | } 45 | 46 | 47 | #################################################################### 48 | ####### end functions ##### 49 | #################################################################### 50 | 51 | #### Main Program 52 | 53 | $svc = Test-BISFService -ServiceName "$servicename" -ProductName "$product" 54 | IF ($svc -eq $true) 55 | { 56 | deleteCCMdata 57 | Invoke-BISFService -ServiceName "$servicename" -Action Start 58 | } 59 | } 60 | 61 | End { 62 | Add-BISFFinishLine 63 | } 64 | 65 | 66 | -------------------------------------------------------------------------------- /Framework/SubCall/Personalization/10_PersBISF_AV-Sophos.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Personalize Sophos AntiVirus for Image Managemement Software 4 | .DESCRIPTION 5 | Create HostID based on MACAddress and start services 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History: 12 | 09.01.2017 MS: Script created 13 | 18.08.2017 FF: Use $ServiceNameS instead of $ServiceName for first Test-BISFService 14 | 15 | .LINK 16 | https://eucweb.com 17 | #> 18 | 19 | Begin { 20 | $script_path = $MyInvocation.MyCommand.Path 21 | $script_dir = Split-Path -Parent $script_path 22 | $script_name = [System.IO.Path]::GetFileName($script_path) 23 | 24 | # Product specified 25 | $Product = "Sophos AntiVirus" 26 | $Inst_path = "$ProgramFilesx86\Sophos\Sophos Anti-Virus" 27 | $ServiceNames = @("Sophos Agent", "Sophos AutoUpdate Service", "Sophos Message Router") 28 | $HostID_Prfx = "00000000-0000-0000-0000-00" 29 | $HostID_File = "C:\programdata\Sophos\AutoUpdate\data\machine_ID.txt" 30 | 31 | } 32 | 33 | Process { 34 | 35 | #################################################################### 36 | ####### functions ##### 37 | #################################################################### 38 | 39 | function CreateGUID { 40 | Write-BISFLog -Msg "GUID Prefix: $HostID_Prfx" 41 | $mac = Get-BISFMACAddress 42 | $regHostID = $HostID_Prfx + $mac 43 | Write-BISFLog -Msg "Write Sophos GUID $regHostID to file $HostID_File" 44 | Out-File -Filepath $HostID_File -inputobject "$regHostID" -Encoding default 45 | } 46 | 47 | function StartService { 48 | ForEach ($ServiceName in $ServiceNames) { 49 | $svc = Test-BISFService -ServiceName "$ServiceName" 50 | IF ($svc -eq $true) { Invoke-BISFService -ServiceName "$($ServiceName)" -Action Start } 51 | } 52 | } 53 | 54 | #################################################################### 55 | ####### end functions ##### 56 | #################################################################### 57 | 58 | #### Main Program 59 | $svc = Test-BISFService -ServiceName $ServiceNames[0] -ProductName "$product" 60 | IF ($svc -eq $true) { 61 | CreateGUID 62 | StartService 63 | 64 | } 65 | } 66 | 67 | 68 | End { 69 | Add-BISFFinishLine 70 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: Bug report 2 | description: Create a report to help us improve. 3 | title: "[Issue]: " 4 | labels: "Type: Bug" 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thank you for taking the time to fill out this bug form! 10 | - type: textarea 11 | id: describe-bug 12 | attributes: 13 | label: Describe the bug 14 | description: A clear and concise description of what the bug is. 15 | validations: 16 | required: true 17 | - type: textarea 18 | id: steps-reproduce 19 | attributes: 20 | label: Steps to reproduce 21 | description: Describe the steps to reproduce the bug as accurately as possible. 22 | placeholder: | 23 | 1: Go to '...' 24 | 2: Click on '....' 25 | 3: Scroll down to '....' 26 | 4: See error 27 | validations: 28 | required: true 29 | - type: textarea 30 | id: expected-behavior 31 | attributes: 32 | label: Expected behavior 33 | description: A clear and concise description of what you expected to happen. 34 | validations: 35 | required: true 36 | - type: textarea 37 | id: screenshots 38 | attributes: 39 | label: Screenshots 40 | description: If applicable, add screenshots to help explain your problem. 41 | validations: 42 | required: false 43 | - type: textarea 44 | id: desktop 45 | attributes: 46 | label: Desktop, please complete the following information. 47 | placeholder: | 48 | OS: [e.g. iOS] 49 | Browser: [e.g. chrome, safari] 50 | Version: [e.g. 22] 51 | validations: 52 | required: false 53 | - type: textarea 54 | id: smartphone 55 | attributes: 56 | label: Smartphone, please complete the following information. 57 | placeholder: | 58 | Device: [e.g. iPhone6] 59 | OS: [e.g. iOS8.1] 60 | Browser: [e.g. stock browser, safari] 61 | Version: [e.g. 22] 62 | validations: 63 | required: false 64 | - type: textarea 65 | id: context 66 | attributes: 67 | label: Additional context 68 | description: Add any other context about the problem here. This will be automatically formatted into code, so no need for backticks. 69 | render: shell 70 | validations: 71 | required: false 72 | -------------------------------------------------------------------------------- /Framework/SubCall/Personalization/01_PersBISF_MS.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | perform Microsoft steps during Startup 4 | .DESCRIPTION 5 | .EXAMPLE 6 | .NOTES 7 | Author: Matthias Schlimm 8 | 9 | History: 10 | 27.10.2014 BR: Script created 11 | 15.10.2014 JP: Added wait:0 parameter fo gpupdate 12 | 06.10.2015 MS: Rewritten script with standard .SYNOPSIS 13 | 26.10.2015 BR: Delay between Timesync and GPO apply 14 | 02.08.2016 MS: With AppLayering in OS-Layer do nothing 15 | 31.08.2017 MS: Change sleep timer from 60 to 5 seconds after time sync on startup 16 | 11.09.2017 MS: Change sleep timer from 5 to 20 seconds after time sync on startup 17 | 21.09.2019 MS: ENH 9 - LAPS Support for Non-Persistent VDI 18 | 04.08.2020 MS: HF 271 - 00_PersBISF_WriteCacheDisk.ps1 fails, due to timing issue with registry values 19 | 24.11.2020 MS: HF 285 - Join AAD if enabled in GPO 20 | 21 | .LINK 22 | https://eucweb.com 23 | #> 24 | 25 | Begin { 26 | $script_path = $MyInvocation.MyCommand.Path 27 | $script_dir = Split-Path -Parent $script_path 28 | $script_name = [System.IO.Path]::GetFileName($script_path) 29 | 30 | } 31 | 32 | Process { 33 | 34 | IF (!($CTXAppLayerName -eq "OS-Layer")) { 35 | IF ($LIC_BISF_CLI_LAPSExpirationTime -eq "YES" ) { SET-BISFLAPSExpirationTime } 36 | # Resync Time with Domain 37 | Write-BISFLog -Msg "Syncing Time from Domain" 38 | & "$env:SystemRoot\system32\w32tm.exe" /config /update 39 | & "$env:SystemRoot\system32\w32tm.exe" /resync /nowait 40 | sleep 30 41 | # Reapply Computer GPO 42 | Write-BISFlog -Msg "Apply Computer GPO" -showConsole -Color Cyan 43 | Start-BISFProcWithProgBar -ProcPath "$env:SystemRoot\system32\gpupdate.exe" -Args "/Target:Computer /Force /Wait:0" -ActText "Apply Computer GPO" 44 | 45 | IF ($LIC_BISF_CLI_MS_AAD_HybridJoinb -eq "YES") { 46 | Write-BISFlog -Msg "Join Azure Active Dirctory " -showConsole -Color Cyan 47 | Start-BISFProcWithProgBar -ProcPath "$env:windir\system32\dsregcmd.exe" -Args "/join" -ActText "Join Azure AD Domain" 48 | Start-BISFProcWithProgBar -ProcPath "$env:windir\system32\dsregcmd.exe" -Args "/status" -ActText "Get Azure AD Domain status" 49 | } ELSE { 50 | Write-BISFlog -Msg "Join Azure Active Dirctory is NOT enabled in BIS-F GPO" -showConsole -Color Cyan 51 | } 52 | } 53 | ELSE { 54 | Write-BISFLog -Msg "Do nothing in AppLayering $CTXAppLayerName" 55 | } 56 | } 57 | 58 | End { 59 | Add-BISFFinishLine 60 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_FSLogix.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare FSLogix Apps for Image Management 4 | .DESCRIPTION 5 | The script detects the installationn of FSLogix and deletes the FSLogix Rules on the Master Image. 6 | You can set a Central Rules Share to copy centralized Rules during the BIS-F personlization phase to the Images. 7 | .EXAMPLE 8 | .NOTES 9 | Author: Matthias Schlimm 10 | 11 | History: 12 | 03.06.2015 MS: Initial script development 13 | 13.08.2015 MS: Central rules share defined and stored in registry location to use at computer startup 14 | 21.08.2015 MS: Remove to set FSLogix service to manual, stopped service only. 15 | 30.09.2015 MS: Rewritten script with standard .SYNOPSIS, use central BISF function to configure service 16 | 06.03.2017 MS: Bugfix read Variable $varCLI = ... 17 | 15.02.2017 MS: Bugfix 237: When in the GPO specify "Configure FSLogix central rule share" to Disabled, the script still prompt for the path when is executed 18 | 15.05.2019 JP: Fixed format and deleted junk lines 19 | 14.08.2019 MS: FRQ 3 - Remove Messagebox and using default setting if GPO is not configured 20 | 13.02.2020 JK: Fixed Grammar 21 | 05.12.2020 MS: HF 294 - function Set-RulesShare no longer required, RulesShare is set in registry policy path 22 | 23 | .LINK 24 | https://eucweb.com 25 | #> 26 | 27 | Begin { 28 | $ErrorActionPreference = "SilentlyContinue" 29 | $script_path = $MyInvocation.MyCommand.Path 30 | $script_dir = Split-Path -Parent $script_path 31 | $script_name = [System.IO.Path]::GetFileName($script_path) 32 | $Product = "FSLogix Apps" 33 | $product_path = "${env:ProgramFiles}\FSLogix\Apps" 34 | $servicename = "FSLogix Apps Services" 35 | } 36 | 37 | Process { 38 | 39 | function ClearConfig { 40 | Write-BISFLog -Msg "Check GPO Configuration" -SubMsg -Color DarkCyan 41 | $varCLIFS = $LIC_BISF_CLI_FS 42 | IF (($varCLIFS -eq "YES") -or ($varCLIFS -eq "NO")) { 43 | Write-BISFLog -Msg "GPO value data: $varCLIFS" 44 | } 45 | ELSE { 46 | Write-BISFLog -Msg "GPO is not configured.. using default setting" -SubMsg -Color DarkCyan 47 | $MPFS = "NO" 48 | } 49 | 50 | if (($MPFS -eq "YES" ) -or ($varCLIFS -eq "YES")) { 51 | Write-BISFLog -Msg "Delete $product Rules" -ShowConsole -Color DarkCyan -SubMsg 52 | Remove-Item -Path "$product_path\Rules\*" -Recurse 53 | } 54 | ELSE { 55 | Write-BISFLog -Msg "Skipping $product Rules deletion" 56 | } 57 | } 58 | 59 | 60 | $svc = Test-BISFService -ServiceName "$servicename" -ProductName "$product" 61 | IF ($svc -eq $true) { 62 | Invoke-BISFService -ServiceName "$servicename" -Action Stop 63 | ClearConfig 64 | 65 | } 66 | } 67 | 68 | End { 69 | Add-BISFFinishLine 70 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_Tanium.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Generalize the Tanium Client prior to sealing the XenApp PVS Target image. 4 | 5 | .NOTES 6 | Author: mtoussiant@dxc.com 7 | 8 | 13.06.2017 - MT :Initial script created 9 | 30.08.2018 - MT Script update to set the service to Automatic and correct a file deletion issue 10 | 14.08.2019 - MS: ENH 118: Add Tanium Support into BIS-F 11 | 12 | 13 | .LINK 14 | https://eucweb.com 15 | 16 | #> 17 | 18 | Begin { 19 | $script_path = $MyInvocation.MyCommand.Path 20 | $script_dir = Split-Path -Parent $script_path 21 | $script_name = [System.IO.Path]::GetFileName($script_path) 22 | $Product = "Tanium" 23 | $ServiceName = "Tanium Client" 24 | } 25 | 26 | Process { 27 | 28 | #################################################################### 29 | ####### functions ##### 30 | #################################################################### 31 | 32 | 33 | 34 | ####### end functions ##### 35 | function Stop-Service { 36 | Invoke-BISFService -ServiceName $ServiceName -Action Stop -StartType Automatic 37 | 38 | } 39 | 40 | function Remove-Data { 41 | 42 | #Set ComputerID to 0 43 | Set-ItemProperty 'HKLM:\SOFTWARE\Wow6432Node\Tanium\Tanium Client' -Name ComputerID -Value 0 44 | 45 | #Delete RegistrationCount 46 | Remove-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Tanium\Tanium Client' -Name RegistrationCount 47 | 48 | #Delete the Strings folder if exists 49 | If(Test-Path "${env:ProgramFiles(x86)}\tanium\Tanium Client\Strings") { 50 | Remove-Item -Path "${env:ProgramFiles(x86)}\tanium\Tanium Client\Strings" -Recurse -Force 51 | } 52 | 53 | #Delete the log0.txt file 54 | If(Test-Path "${env:ProgramFiles(x86)}\tanium\Tanium Client\log0.txt") { 55 | Remove-Item -Path "${env:ProgramFiles(x86)}\tanium\Tanium Client\log0.txt" 56 | } 57 | 58 | 59 | #Empty the Downloads folder 60 | If(Test-Path "${env:ProgramFiles(x86)}\tanium\Tanium Client\Downloads") { 61 | Remove-Item -Path "${env:ProgramFiles(x86)}\tanium\Tanium Client\Downloads\*" -Recurse -Force 62 | } 63 | 64 | #Delete all files in the Tools\Scans and Tools\Content Logs folders. 65 | If(Test-Path "${env:ProgramFiles(x86)}\tanium\Tanium Client\Tools\Scans") { 66 | Remove-Item -Path "${env:ProgramFiles(x86)}\tanium\Tanium Client\Tools\Scans\*" -Recurse -Force 67 | } 68 | If(Test-Path "${env:ProgramFiles(x86)}\tanium\Tanium Client\Tools\Content Logs") { 69 | Remove-Item -Path "${env:ProgramFiles(x86)}\tanium\Tanium Client\Tools\Content Logs\*" -Recurse -Force 70 | } 71 | 72 | } 73 | #### Main Program 74 | 75 | $svc = Test-BISFService -ServiceName $ServiceName -ProductName "$product" 76 | IF ($svc -eq $true) { 77 | Stop-Service 78 | Remove-Data 79 | 80 | } 81 | 82 | } 83 | 84 | End { 85 | Add-BISFFinishLine 86 | } 87 | -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_Turbo.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare Turbo.net Applications for Image Management 4 | .DESCRIPTION 5 | Update the turbo subscription 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | 10 | History: 11 | 17.03.2016 MS: Script created 12 | 06.03.2017 MS: Bugfix read Variable $varCLI = ... 13 | 14.08.2019 MS: FRQ 3 - Remove Messagebox and using default setting if GPO is not configured 14 | 18.02.2020 JK: Fixed Log output spelling 15 | 16 | .LINK 17 | https://eucweb.com 18 | #> 19 | 20 | Begin { 21 | 22 | #################################################################### 23 | # define environment 24 | $PSScriptFullName = $MyInvocation.MyCommand.Path 25 | $PSScriptRoot = Split-Path -Parent $PSScriptFullName 26 | $PSScriptName = [System.IO.Path]::GetFileName($PSScriptFullName) 27 | 28 | #product specified 29 | $Product = "Turbo.net" 30 | $ProductInstPath = "$ProgramFilesx86\Spoon\Cmd\Turbo.exe" 31 | 32 | } 33 | 34 | Process { 35 | 36 | #################################################################### 37 | ####### functions ##### 38 | #################################################################### 39 | 40 | function Set-TurboSupscriptionUpdate { 41 | Write-BISFLog -Msg "Check GPO Configuration" -SubMsg -Color DarkCyan 42 | $varCLITB = $LIC_BISF_CLI_TB 43 | IF (($varCLITB -eq "YES") -or ($varCLITB -eq "NO")) { 44 | Write-BISFLog -Msg "GPO Valuedata: $varCLI" 45 | } 46 | ELSE { 47 | Write-BISFLog -Msg "GPO not configured.. using default setting" -SubMsg -Color DarkCyan 48 | $MPFullScan = "NO" 49 | } 50 | 51 | if (($MPTB -eq "YES" ) -or ($varCLITB -eq "YES")) { 52 | Write-BISFLog -Msg "The Turbo.net Supscription Update will not be run on system startup" -ShowConsole -Color DarkCyan -SubMsg 53 | $answerTB = "YES" 54 | } 55 | ELSE { 56 | Write-BISFLog -Msg "The Turbo.net Supscription Update will NOT be run on system startup" 57 | $answerTB = "NO" 58 | } 59 | 60 | 61 | IF (($answerTB -eq "YES") -or ($answerTB -eq "NO")) { 62 | Write-BISFLog -Msg "set your Turbo.net answer to the registry $hklm_software_LIC_CTX_BISF_SCRIPTS, Name LIC_BISF_TurboRun, value $answerTB" 63 | Set-ItemProperty -Path $hklm_software_LIC_CTX_BISF_SCRIPTS -Name "LIC_BISF_TurboRun" -value "$answerTB" -Force 64 | } 65 | } 66 | 67 | #################################################################### 68 | ####### end functions ##### 69 | #################################################################### 70 | 71 | #### Main Program 72 | 73 | IF (Test-Path ("$ProductInstPath") -PathType Leaf) { 74 | Write-BISFLog -Msg "Product $Product installed" -ShowConsole -Color Cyan 75 | Set-TurboSupscriptionUpdate 76 | 77 | } 78 | ELSE { 79 | Write-BISFLog -Msg "Product $Product is not installed" 80 | } 81 | } 82 | 83 | End { 84 | Add-BISFFinishLine 85 | } -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | Contributions to **BIS-F** are highly encouraged and desired. Below are some guidelines that will help make the process as smooth as possible. 3 | 4 | # Getting Started 5 | * Make sure you have a [GitHub account](https://github.com/signup/free) 6 | * Submit a new issue, assuming one does not already exist. 7 | * Clearly describe the issue including steps to reproduce when it is a bug. 8 | * Make sure you fill in the earliest version that you know has the issue. 9 | * Fork the repository on GitHub 10 | 11 | # Suggesting Enhancements 12 | I want to know what you think is missing from this module and how it can be made better. 13 | * When submitting an issue for an enhancement, please be as clear as possible about why you think the enhancement is needed and what the benefit of it would be. 14 | 15 | # Making Changes 16 | * From your fork of the repository, create a topic branch where work on your change will take place. 17 | * To quickly create a topic branch based on master; `git checkout -b my_contribution master`. Please avoid working directly on the `master` branch. 18 | * Make commits of logical units. 19 | * Check for unnecessary whitespace with `git diff --check` before committing. 20 | * Please follow the prevailing code conventions in the repository. Differences in style make the code harder to understand for everyone. 21 | * Make sure your commit messages are in the proper format. 22 | ```` 23 | Add more cowbell to Get-Something.ps1 24 | 25 | The functionaly of Get-Something would be greatly improved if there was a little 26 | more 'pizzazz' added to it. I propose a cowbell. Adding more cowbell has been 27 | shown in studies to both increase one's mojo, and cement one's status 28 | as a rock legend. 29 | ```` 30 | 31 | * Make sure you have added all the necessary Pester tests for your changes. 32 | * Run _all_ PESTER tests in the module to assure nothing else was accidentally broken. 33 | * PS1 files must contain only one function 34 | 35 | # Documentation 36 | I am infallible and as such my documenation needs no corectoin. In the highly 37 | unlikely event that that is _not_ the case, commits to update or add documentation 38 | are highly apprecaited. 39 | 40 | # Submitting Changes 41 | * Push your changes to a topic branch in your fork of the repository. 42 | * Submit a pull request to the **master** branch in the main repository. 43 | * Once the pull request has been reviewed and accepted, it will be merged with the master branch. 44 | 45 | # Additional Resources 46 | * [General GitHub documentation](https://help.github.com/) 47 | * [GitHub forking documentation](https://guides.github.com/activities/forking/) 48 | * [GitHub pull request documentation](https://help.github.com/send-pull-requests/) 49 | * [GitHub Flow guide](https://guides.github.com/introduction/flow/) 50 | * [GitHub's guide to contributing to open source projects](https://guides.github.com/activities/contributing-to-open-source/) 51 | -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_AV-KAVFS.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare Kaspersky Antivirus for Image Management 4 | .DESCRIPTION 5 | Delete computer specific entries 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History: 12 | 15.12.2015 MS: Initial script development 13 | 23.03.2016 MS: add -Recurse to search for files in subfolders 14 | 12.03.2017 MS: BugFix 112: wrong path to get from executable 15 | 18.02.2020 JK: Fixed Log output spelling 16 | 17 | .LINK 18 | https://eucweb.com 19 | #> 20 | 21 | Begin { 22 | $script_path = $MyInvocation.MyCommand.Path 23 | $script_dir = Split-Path -Parent $script_path 24 | $script_name = [System.IO.Path]::GetFileName($script_path) 25 | $servicename = "KAVFS" 26 | $Product = "Kaspersky AntiVirus" 27 | $SearchFolder = "C:\Program Files (x86)\Kaspersky Lab" 28 | $KAVexe1 = "klmover.exe" 29 | $KAVarg1_1 = "-dupfix" 30 | $KAVexe2 = "kavshell.exe" 31 | $KAVarg2_1 = "update /KL" 32 | $KAVarg2_2 = "task update-bases /start" 33 | $KAVarg2_3 = "task update-app /start" 34 | $KAVPath1 = $null 35 | $KAVPath2 = $null 36 | 37 | 38 | } 39 | 40 | Process { 41 | 42 | #################################################################### 43 | ####### functions ##### 44 | #################################################################### 45 | 46 | ####### end functions ##### 47 | 48 | #### Main Program 49 | $svc = Test-BISFService -ServiceName "$servicename" -ProductName "$product" 50 | IF ($svc -eq $true) { 51 | $KAVPath1 = Get-ChildItem -Path "$SearchFolder" -filter "$KAVexe1" -Recurse -ErrorAction SilentlyContinue | % { $_.FullName } 52 | IF ($KAVPath1 -ne $null) { 53 | $KAVPathname1 = $KAVPath1 54 | Write-BISFLog -Msg "$Product optimizing now for Imaging" -SubMsg -ShowConsole 55 | 56 | Write-BISFLog -Msg "Running $KAVPathname1 $KAVarg1_1" 57 | Start-Process -FilePath "$KAVPathname1" -ArgumentList "$KAVarg1_1" -Wait | Out-Null 58 | } 59 | ELSE { 60 | Write-BISFLog -Msg "$KAVexe1 couldn't be found in any folders above $SearchFolder, correct Imaging can't be guaranteed!" -type W -SubMsg 61 | } 62 | 63 | $KAVPath2 = Get-ChildItem -Path "$SearchFolder" -filter "$KAVexe2" -Recurse -ErrorAction SilentlyContinue | % { $_.FullName } 64 | IF ($KAVPath2 -ne $null) { 65 | $KAVPathname2 = $KAVPath2 66 | Write-BISFLog -Msg "$Product optimize now for Imaging" -SubMsg -ShowConsole 67 | 68 | Write-BISFLog -Msg "Running $KAVPathname2 $KAVarg2_1" 69 | Start-Process -FilePath "$KAVPathname2" -ArgumentList "$KAVarg2_1" -Wait | Out-Null 70 | 71 | Write-BISFLog -Msg "Running $KAVPathname2 $KAVarg2_2" 72 | Start-Process -FilePath "$KAVPathname2" -ArgumentList "$KAVarg2_2" -Wait | Out-Null 73 | 74 | Write-BISFLog -Msg "Running $KAVPathname2 $KAVarg2_3" 75 | Start-Process -FilePath "$KAVPathname2" -ArgumentList "$KAVarg2_3" -Wait | Out-Null 76 | } 77 | ELSE { 78 | Write-BISFLog -Msg "$KAVexe2 couldn't be found in any folders above $SearchFolder, correct Imaging can't be guaranteed!" -type W -SubMsg 79 | } 80 | } 81 | } 82 | 83 | End { 84 | Add-BISFFinishLine 85 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_AV-EPC.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare Microsoft Security Client for Image Management 4 | .DESCRIPTION 5 | Reconfigure the Microsoft Security Client 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History: 12 | 25.03.2014 MS: Script created 13 | 01.04.2014 MS: Changed Console message 14 | 12.05.2014 MS: Changed Fullscan from Windows Defender directory to '$MSC_path\...' 15 | 13.05.2014 MS: Added Silentswitch -AVFullScan (YES|NO) 16 | 11.06.2014 MS: Syntax error to start silent pattern update and fullscan, fix read variable LIC_BISF_CLI_AV 17 | 13.08.2014 MS: Removed $logfile = Set-logFile, it would be used in the 10_XX_LIB_Config.ps1 Script only 18 | 20.02.2015 MS: Added progressbar during fullscan 19 | 30.09.2015 MS: Rewritten script with standard .SYNOPSIS, use central BISF function to configure service 20 | 06.03.2017 MS: Bugfix read Variable $varCLI = ... 21 | 16.08.2019 MS: FRQ 3 - Remove Messagebox and using default setting if GPO is not configured 22 | 03.10.2019 MS: ENH 51 - ADMX Extension: select AnitVirus full scan or custom Scan arguments 23 | 18.02.2020 JK: Fixed Log output spelling 24 | .LINK 25 | https://eucweb.com 26 | #> 27 | 28 | Begin { 29 | $PSScriptFullName = $MyInvocation.MyCommand.Path 30 | $PSScriptRoot = Split-Path -Parent $PSScriptFullName 31 | $PSScriptName = [System.IO.Path]::GetFileName($PSScriptFullName) 32 | $product = "Microsoft Security Client" 33 | $MSC_path = "C:\Program Files\$product" 34 | } 35 | 36 | Process { 37 | 38 | function MSCrun { 39 | 40 | Write-BISFLog -Msg "Update VirusSignatures" 41 | & "$MSC_path\MpCMDrun.exe" -SignatureUpdate 42 | 43 | Write-BISFLog -Msg "Check GPO Configuration" -SubMsg -Color DarkCyan 44 | $varCLI = $LIC_BISF_CLI_AV 45 | 46 | IF (($varCLI -eq "YES") -or ($varCLI -eq "NO")) { 47 | Write-BISFLog -Msg "GPO Valuedata: $varCLI" 48 | } 49 | ELSE { 50 | Write-BISFLog -Msg "GPO not configured.. using default setting" -SubMsg -Color DarkCyan 51 | $AVScan = "YES" 52 | } 53 | 54 | if (($AVScan -eq "YES" ) -or ($varCLI -eq "YES")) { 55 | IF ($LIC_BISF_CLI_AV_VIE_CusScanArgsb -eq 1) { 56 | Write-BISFLog -Msg "Enable Custom Scan Arguments" 57 | $args = $LIC_BISF_CLI_AV_VIE_CusScanArgs 58 | } 59 | ELSE { 60 | $args = "-scan -scantype 2" 61 | } 62 | 63 | Write-BISFLog -Msg "Running Scan with arguments: $args" 64 | Start-Process -FilePath "$MSC_path\MpCMDrun.exe" -ArgumentList $args 65 | Show-ProgressBar -CheckProcess "MpCMDrun" -ActivityText "$Product is scanning the system...please wait" 66 | } 67 | ELSE { 68 | Write-BISFLog -Msg "No Scan will be performed" 69 | } 70 | } 71 | 72 | #################################################################### 73 | ####### end functions ##### 74 | #################################################################### 75 | 76 | #### Main Program 77 | IF (Test-Path ("$MSC_path\MpCMDRun.exe") -PathType Leaf ) { 78 | Write-BISFLog -Msg "$Product installed" -ShowConsole -Color Cyan 79 | MSCrun 80 | } 81 | ELSE { 82 | Write-BISFLog -Msg "$Product is not installed" 83 | } 84 | 85 | } 86 | 87 | End { 88 | Add-BISFFinishLine 89 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_AV-F-Secure.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare F-Secure AntiVirus for Image Managemement 4 | .DESCRIPTION 5 | Scan system and stop services 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | 10 | History: 11 | 29.07.2017 MS: Script created 12 | 14.08.2019 MS: FRQ 3 - Remove Messagebox and using default setting if GPO is not configured 13 | 03.10.2019 MS: ENH 51 - ADMX Extension: select AnitVirus full scan or custom Scan arguments 14 | 18.02.2020 JK: Fixed Log output spelling 15 | 16 | .LINK 17 | https://eucweb.com 18 | #> 19 | 20 | Begin { 21 | $script_path = $MyInvocation.MyCommand.Path 22 | $script_dir = Split-Path -Parent $script_path 23 | $script_name = [System.IO.Path]::GetFileName($script_path) 24 | 25 | # Product specified 26 | $Product = "F-Secure Anti-Virus" 27 | $Inst_path = "$ProgramFilesx86\F-Secure\Anti-Virus" 28 | $ServiceNames = @("FSAUA", "FSMA", "F-Secure Network Request Broker", "FSORSPClient", "F-Secure WebUI Daemon", "F-Secure Gatekeeper Handler Starter") 29 | } 30 | 31 | Process { 32 | 33 | #################################################################### 34 | ####### functions ##### 35 | #################################################################### 36 | 37 | 38 | function RunFullScan { 39 | 40 | Write-BISFLog -Msg "Check GPO Configuration" -SubMsg -Color DarkCyan 41 | $varCLI = $LIC_BISF_CLI_AV 42 | IF (($varCLI -eq "YES") -or ($varCLI -eq "NO")) { 43 | Write-BISFLog -Msg "GPO Valuedata: $varCLI" 44 | } 45 | ELSE { 46 | Write-BISFLog -Msg "GPO not configured.. using default setting" -SubMsg 47 | $AVScan = "YES" 48 | } 49 | if (($AVScan -eq "YES" ) -or ($varCLI -eq "YES")) { 50 | IF ($LIC_BISF_CLI_AV_VIE_CusScanArgsb -eq 1) { 51 | Write-BISFLog -Msg "Enable Custom Scan Arguments" 52 | $args = $LIC_BISF_CLI_AV_VIE_CusScanArgs 53 | } 54 | ELSE { 55 | $args = "c:\ /REPORT=C:\Windows\Logs\fsavlog.txt" 56 | } 57 | 58 | Write-BISFLog -Msg "Running Scan with arguments: $args" 59 | Start-Process -FilePath "$Inst_path\fsav.exe" -ArgumentList $args 60 | Show-BISFProgressBar -CheckProcess "$ScanProcess" -ActivityText "$Product is scanning the system...please wait" 61 | IF (Test-Path "C:\Windows\Logs\fsavlog.txt") { 62 | Get-BISFLogContent -GetLogFile "C:\Windows\Logs\fsavlog.txt" 63 | Remove-Item -Path "C:\Windows\Logs\fsavlog.txt" -Force 64 | } 65 | } 66 | ELSE { 67 | Write-BISFLog -Msg "No Scan will be performed" 68 | } 69 | 70 | } 71 | 72 | 73 | 74 | function StopService { 75 | ForEach ($ServiceName in $ServiceNames) { 76 | $svc = Test-BISFService -ServiceName "$ServiceName" 77 | IF ($svc -eq $true) { Invoke-BISFService -ServiceName "$($ServiceName)" -Action Stop } 78 | } 79 | } 80 | 81 | #################################################################### 82 | ####### end functions ##### 83 | #################################################################### 84 | 85 | #### Main Program 86 | $svc = Test-BISFService -ServiceName $ServiceNames[1] -ProductName "$product" 87 | IF ($svc -eq $true) { 88 | RunFullScan 89 | StopService 90 | } 91 | } 92 | 93 | 94 | End { 95 | Add-BISFFinishLine 96 | } 97 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at bisf@eucweb.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /Framework/SubCall/Personalization/10_PersBISF_AV-TM.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Personalize TrenMicro OfficeScan for Image Management Software 4 | .DESCRIPTION 5 | Create HostID based on MACAddress 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History: 12 | 17.09.2014 MS: Script created 13 | 10.08.2015 MS: define array for TM services for better scripthandling 14 | 06.10.2015 MS: rewritten script with standard .SYNOPSIS 15 | 09.01.2017 MS: change code to get MacAdress to use function Get-BISMACAddress 16 | 01.08.2017 JS: Added the TmPfw (OfficeScan NT Firewall) service to the array 17 | 19.02.2020 MS: HF 212 - MACAddress in lowercase with seperated switch to fix HF 137 18 | 29.05.2020 MS: HF 233 - TrendMicro Apex One Services not startet 19 | 05.06.2020 MS: HF 233 - Skipping ApexOne, checkout https://github.com/EUCweb/BIS-F/issues/233 for further informations 20 | .LINK 21 | https://eucweb.com 22 | #> 23 | 24 | 25 | Begin { 26 | $reg_TM_string = "$HKLM_sw_x86\TrendMicro\PC-cillinNTCorp\CurrentVersion" 27 | $reg_TM_name = "GUID" 28 | $product = "Trend Micro Office Scan" 29 | $product1 = "Trend Micro Apex ONE" 30 | # The main 4 services are: 31 | # - TmListen (OfficeScan NT Listener) 32 | # - NTRTScan (OfficeScan NT RealTime Scan) 33 | # - TmPfw (OfficeScan NT Firewall) 34 | # - TmProxy (OfficeScan NT Proxy Service) 35 | $TMServices = @("TmListen", "NTRTScan", "TmProxy", "TmPfw", "TmCCSF", "TMBMServer") 36 | $HostID_Prfx = "00000000-0000-0000-0000-" 37 | $script_path = $MyInvocation.MyCommand.Path 38 | $script_dir = Split-Path -Parent $script_path 39 | $script_name = [System.IO.Path]::GetFileName($script_path) 40 | 41 | } 42 | 43 | Process { 44 | 45 | 46 | ## Start TM Service 47 | function StartService { 48 | ForEach ($TMService in $TMServices) { 49 | # check if service exist 50 | 51 | $svc = Test-BISFService -ServiceName "$TMService" 52 | IF ($svc -eq $true) { 53 | Invoke-BISFService -ServiceName "$TMService" -Action Start 54 | } 55 | } 56 | } 57 | 58 | 59 | ## set HostID in Registry 60 | function SetHostID { 61 | $mac = Get-BISFMACAddress -ConvertToLower 62 | Write-BISFLog -Msg "$reg_SEP_name Prefix: $HostID_Prfx" 63 | $regHostID = $HostID_Prfx + $mac 64 | Write-BISFLog -Msg "set TrendMicro $reg_TM_name in Registry $regHostID_string..." 65 | Set-ItemProperty -Path $reg_TM_string -Name $reg_TM_name -value $regHostID -ErrorAction SilentlyContinue 66 | } 67 | #################################################################### 68 | 69 | #### Main Program 70 | $svc = Test-BISFService -ServiceName $TMServices[0] -ProductName "$product" 71 | $ApexOne = Test-BISFService -ServiceName $TMServices[5] -ProductName "$product1" 72 | 73 | IF ($ApexOne) { 74 | Write-BISFLog -Msg "Skipping $product1 personalization" -Type W -ShowConsole -SubMsg 75 | Write-BISFLog -M Msg "Please Checkout ApexOne Support https://github.com/EUCweb/BIS-F/issues/233 for further information" -Type W -ShowConsole -SubMsg 76 | start-sleep 10 77 | } ELSE { 78 | 79 | IF ($svc) { 80 | # Note that if the services start before the GUID is set it won't register with the OfficeScan Management Server 81 | SetHostID 82 | StartService 83 | } 84 | } 85 | 86 | } 87 | 88 | End { 89 | Add-BISFFinishLine 90 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_Empirum.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare Matrix 42 Empirum Agent for Image Management 4 | .DESCRIPTION 5 | Delete computer specific entries 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History: 12 | 16.09.2014 MS: Script created 13 | 27.10.2014 MS: Fix wrong $cachelocation from XML-File (thx to David Rosenthal) 14 | 12.12.2014 MS: syntax error at line 33 15 | 30.09.2015 MS: rewritten script with standard .SYNOPSIS, use central BISF function to configure service 16 | 28.05.2019 MK: added a more stable verification for the empirum services and $cachelocation\Packages\* to file removal 17 | 18 | .LINK 19 | https://eucweb.com 20 | #> 21 | 22 | Begin { 23 | $Empirum_path = "C:\Windows\System32\Empirum" 24 | $script_path = $MyInvocation.MyCommand.Path 25 | $script_dir = Split-Path -Parent $script_path 26 | $script_name = [System.IO.Path]::GetFileName($script_path) 27 | $ServiceNames = @("Eris", "MATRIXAUT") 28 | $product = "Matrix42 Empirum" 29 | } 30 | 31 | Process { 32 | 33 | function StopService { 34 | ForEach ($ServiceName in $ServiceNames) { 35 | $svc = Test-BISFService -ServiceName "$ServiceName" 36 | IF ($svc -eq $true) { Invoke-BISFService -ServiceName "$($ServiceName)" -Action Stop } 37 | } 38 | } 39 | function deleteAgentData { 40 | [xml]$xmlfile = Get-Content "$Empirum_path\AgentConfig.xml" 41 | $cachelocation = Select-Xml "//Transport/Protocols/CommonParameters/LocalCache[@Platform='Windows']" $xmlfile | % { $_.Node.'#text' } 42 | Write-Log -Msg "get cachelocation from XML-File $xmlfile $cachelocation" 43 | if ($cachelocation -match "(%.*%)\\") { 44 | $cachelocation = $cachelocation -replace "%(.*%)\\", "$(cmd /C echo $matches[0])" 45 | } 46 | Write-Log -Msg "remove Empirum Agent LocalCache in path $cachelocation" -Color Cyan 47 | Remove-Item "$cachelocation\DDC\Machine\*" -Force -Recurse 48 | Remove-Item "$cachelocation\DDC\User\*" -Force -Recurse 49 | Remove-Item "$cachelocation\DDS\*" -Force -Recurse 50 | Remove-Item "$cachelocation\Values\MachineValues\*" -Force -Recurse 51 | Remove-Item "$cachelocation\Values\UserValues\*" -Force -Recurse 52 | Remove-Item "$cachelocation\Packages\*" -Force -Recurse 53 | Remove-Item "$cachelocation\PatchManagement\Repository\Patches*" -Force -Recurse 54 | 55 | Write-Log -Msg "remove Empirum Agent specified registry entries" -Color Cyan 56 | Remove-Item "$hklm_sw\MATRIX42\AGENT" -Force -ErrorAction SilentlyContinue 57 | Remove-Item "$hklm_sw\MATRIX42\ApplicationUsageTracking" -Force -ErrorAction SilentlyContinue 58 | Remove-Item "$hklm_sw\MATRIX42\ComManager\CACHE\Items" -Force -ErrorAction SilentlyContinue 59 | Remove-Item "$hklm_sw\MATRIX42\EmpInv" -Force -ErrorAction SilentlyContinue 60 | Remove-Item "$hklm_sw\MATRIX42\Empirum Installer" -Force -ErrorAction SilentlyContinue 61 | Remove-Item "$hklm_sw\MATRIX42\RebootPackagesPending" -Force -ErrorAction SilentlyContinue 62 | } 63 | 64 | #################################################################### 65 | ####### end functions ##### 66 | #################################################################### 67 | 68 | #### Main Program 69 | $svc = Test-BISFService -ServiceName $ServiceNames[0] -ProductName "$product" 70 | if ($svc -eq $true) { 71 | StopService 72 | DeleteAgentData 73 | } 74 | } 75 | 76 | End { 77 | Add-BISFFinishLine 78 | } -------------------------------------------------------------------------------- /Framework/SubCall/Personalization/10_PersBISF_FSLogix.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Copy FSLogix rules and assignments from central share 4 | .DESCRIPTION 5 | .EXAMPLE 6 | .NOTES 7 | Author: Matthias Schlimm 8 | Company: EUCWeb.com 9 | 10 | History: 11 | 03.06.2015 MS: Initial script development 12 | 13.08.2015 MS: Copy FSLogix rules and assignment files from central share to the FSLogix Apps rules folder at computer startup 13 | 17.08.2015 MS: The FSlogix rules are copied from the central share but not applied, in the FSLogix personalization script, the copy must be performed after starting the FSLogix service, to resolve this issue 14 | 21.08.2015 MS: Do not checked PVS or MCS DiskMode, Service is already running or will be started if stopped 15 | 01.10.2015 MS: rewritten script with standard .SYNOPSIS, use central BISF function to configure service 16 | 03.10.2019 MS: ENH 141 - FSLogix App Masking URL Rule Files 17 | 03.10.2019 MS: ENH 140 - cleanup redirected CloudCache empty directories 18 | 13.02.2020 JK: Fixed Log output spelling 19 | 05.12.2020 MS: HF 294 - using registry policy vlaue from $LIC_BISF_CLI_RS to get the central rules share 20 | 21 | .LINK 22 | https://eucweb.com 23 | #> 24 | Begin { 25 | $ErrorActionPreference = "SilentlyContinue" 26 | 27 | $script_path = $MyInvocation.MyCommand.Path 28 | $script_dir = Split-Path -Parent $script_path 29 | $script_name = [System.IO.Path]::GetFileName($script_path) 30 | $Product = "FSLogix Apps" 31 | $product_path = "${env:ProgramFiles}\FSLogix\Apps" 32 | $servicename = "FSLogix Apps Services" 33 | $FSXrulesDest = "$product_path\Rules" 34 | $FSXfiles2Copy = @("*.fxr", "*.fxa", "*.xml") 35 | } 36 | 37 | Process { 38 | 39 | 40 | function Copy-FSXRules { 41 | $ErrorActionPreference = "Stop" 42 | IF (!([string]::IsNullOrEmpty($LIC_BISF_CLI_RS))) { 43 | If (Test-Path -Path $LIC_BISF_CLI_RS) { 44 | Write-Log -Msg "Starting copy of $Product Rules & Assignment files" -showConsole -Color Cyan 45 | ForEach ($FileCopy in $FSXfiles2Copy) { 46 | Write-Log -Msg "Copy $Product $FileCopy files" 47 | Copy-Item -Path "$LIC_BISF_CLI_RS\*" -Filter "$FileCopy" -Destination "$FSXrulesDest" 48 | } 49 | } 50 | ELSE { 51 | $ErrorActionPreference = "Continue" 52 | Write-Log -Msg "$Product Central Rules Share '$LIC_BISF_CLI_RS' is not accessible or user '$cu_user' does not have enough rights!" -Type W -ShowConsole 53 | } 54 | } 55 | ELSE { 56 | $ErrorActionPreference = "Continue" 57 | Write-Log -Msg "No $Product Central Rules Share defined, didn't copy files!" -Type W 58 | } 59 | } 60 | 61 | Function Clear-RedirectedCloudCache { 62 | Write-Log -Msg "Processing $Product CloudCache" -ShowConsole -Color Cyan 63 | $frxreg = "HKLM:\SYSTEM\CurrentControlSet\Services\frxccds\Parameters" 64 | $FRXProxyDirectory = (Get-ItemProperty $frxreg -ErrorAction SilentlyContinue).ProxyDirectory 65 | $FRXWriteCacheDirectory = (Get-ItemProperty $frxreg -ErrorAction SilentlyContinue).WriteCacheDirectory 66 | $FRXDirectories = @("$FRXProxyDirectory", "$FRXWriteCacheDirectory") 67 | ForEach ($FRXDir in $FRXDirectories) { 68 | Write-Log -Msg "Processing $FRXDir" -ShowConsole -Color DarkCyan -SubMsg 69 | IF (Test-Path $FRXDir -PathType Leaf) { 70 | $FRXDrive = $FRXDir.substring(0, 2) 71 | IF ($FRXDrive -ne $env:SystemDrive) { 72 | Write-Log -Msg "Drive is different from the System Drive, cleanup now" -ShowConsole -Color DarkCyan -SubMsg 73 | Remove-Item "$FRXDir\*" -recurse 74 | } 75 | } 76 | ELSE { 77 | Write-Log -Msg "Directory $FRXDir does not exist" 78 | } 79 | ELSE { 80 | Write-Log -Msg "Drive is not different from System Drive, skipping" -ShowConsole -Color DarkCyan -SubMsg 81 | } 82 | } 83 | } 84 | 85 | 86 | $svc = Test-BISFService -ServiceName "$servicename" -ProductName "$product" 87 | IF ($svc) { 88 | Copy-FSXRules 89 | Clear-RedirectedCloudCache 90 | } 91 | } 92 | End { 93 | Add-BISFFinishLine 94 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_SCOM.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare SCOM Client for Image Managemement 4 | .DESCRIPTION 5 | Delete computer specific entries 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History: 12 | 17.11.2014 MS: Script created for OpsMagr2k7 13 | 19.02.2015 MS: change line 65 to IF ($svc -And (Test-Path $OpsStateDirOrigin)) 14 | 04.05.2015 MS: add SCOM 2012 detection, checks 2007 path only 15 | 30.07.2015 MS: Fix line 39: rename $returnCheckPVSSoftware to $returnTestPVSSoftware 16 | 01.10.2015 MS: rewritten script with standard .SYNOPSIS, use central BISF function to configure service 17 | 03.10.2017 MS: Bugfix 214: Test path if $OpsStateDirOrigin before delete, instead of complete C: content if if $OpsStateDirOrigin is not available 18 | 29.03.2018 MS: Bugfix 37: SCOM 2018, uses new cerfifcate store Microsoft Monitoring Agent 19 | 18.02.2020 JK: Fixed Log output spelling 20 | 21 | .LINK 22 | https://eucweb.com 23 | #> 24 | 25 | Begin { 26 | $OpsStateDir = "$PVSDiskDrive\OpsStateDir" 27 | $OpsStateDirOrigin2012 = "$env:ProgramFiles\Microsoft Monitoring Agent\Agent\Health Service State" 28 | $OpsStateDirOrigin2007 = "$ProgramFilesx86\System Center Operations Manager 2007\Health Service State" 29 | $servicename = "HealthService" 30 | $Product = "Microsoft SCOM Agent" 31 | $script_path = $MyInvocation.MyCommand.Path 32 | $script_dir = Split-Path -Parent $script_path 33 | $script_name = [System.IO.Path]::GetFileName($script_path) 34 | } 35 | #################################################################### 36 | ####### functions ##### 37 | #################################################################### 38 | 39 | Process { 40 | 41 | 42 | function ReconfigureAgent { 43 | Write-BISFLog -Msg "remove existing certificates for $product" 44 | Try { 45 | & Invoke-Expression "certutil -delstore ""Operations Manager"" $env:Computername.$env:userdnsdomain" | Out-Null 46 | } 47 | Catch { 48 | Write-BISFlog -Msg "Certificate Operations Manager can't be removed" 49 | } 50 | 51 | #required for SCOM 2016 an later too 52 | Try { 53 | & Invoke-Expression "certutil -delstore ""Microsoft Monitoring Agent"" 0" | Out-Null 54 | } 55 | Catch { 56 | Write-BISFlog -Msg "Certificate Microsoft Monitoring Agent can't be removed" 57 | } 58 | 59 | IF ($returnTestPVSSoftware -eq "true") { 60 | Write-BISFLog -Msg "Citrix PVS Target Device detected, Setting StateDirectory to Path $OpsStateDir" 61 | Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\services\$servicename\Parameters" -Name "State Directory" -Value "$OpsStateDir" 62 | } 63 | ELSE { 64 | Write-BISFLog -Msg "Citrix PVS Target Device NOT detected, StateDirectory left on original path $OpsStateDirOrigin" 65 | } 66 | 67 | if (Test-Path $OpsStateDirOrigin) { 68 | Write-BISFLog -Msg "Delete Path $OpsStateDirOrigin" 69 | Remove-Item -Path "$OpsStateDirOrigin\*" -recurse 70 | } 71 | } 72 | 73 | #################################################################### 74 | ####### end functions ##### 75 | #################################################################### 76 | 77 | #### Main Program 78 | 79 | $svc = Test-BISFService -ServiceName "$servicename" -ProductName "$product" 80 | IF ($svc -eq $true) { 81 | $OpsStateDirOrigin = @() # set empty variable to check later if Ops/SCOM installed 82 | IF (Test-Path $OpsStateDirOrigin2012) { $OpsStateDirOrigin = $OpsStateDirOrigin2012 } 83 | IF (Test-Path $OpsStateDirOrigin2007) { $OpsStateDirOrigin = $OpsStateDirOrigin2007 } 84 | 85 | IF ($OpsStateDirOrigin -ne $null) { 86 | Write-BISFLog -Msg "Path $OpsStateDirOrigin detected" 87 | Invoke-BISFService -ServiceName "$servicename" -Action Stop -StartType manual 88 | ReconfigureAgent 89 | } 90 | ELSE { 91 | Write-BISFLog -Msg "$Service $ServiceName detected, but path $OpsStateDirOrigin2012 or $OpsStateDirOrigin2007 not found. $product will not be optimized for Imaging" -Type E -SubMsg 92 | } 93 | } 94 | } 95 | 96 | End { 97 | Add-BISFFinishLine 98 | } -------------------------------------------------------------------------------- /Framework/SubCall/Personalization/10_PersBISF_ZCM.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare Novell ZCM Agent for Image Management Software 4 | .DESCRIPTION 5 | .EXAMPLE 6 | .NOTES 7 | Author: Benjamin Ruoff 8 | Company: EUCWeb.com 9 | 10 | History: 11 | 04.03.2014 BR: Script created 12 | 11.03.2014 MS: IF (Test-Path ("C:\Program Files (x86)\Novell\ZENworks\bin\zac.exe")) 13 | 21.03.2014 MS: last code change before release to web 14 | 12.05.2014 MS: Change from $ZCMConfigPath = "D:\ZCM\" to $ZCMConfigPath = "$PVSDiskDrive\ZCM\" 15 | 12.05.2014 MS: get ZCM Argumentlist from custom specified registry value -->> $LIC_PVS_ZCM_CFG 16 | 13.08.2014 MS: remove $logfile = Set-logFile, it would be used in the 10_XX_LIB_Config.ps1 Script only 17 | 15.08.2014 MS: Add Else condition -> Write-BISFLog -Msg "ZENworks Configuration Management not installed" 18 | 17.08.2014 MS: rewrite script for 32 bit and 64 bit, use $ProgramFilesx86 from function get-osinfo instead of hardcoded path 19 | 10.02.2015 MS: rename syntax from PVS to BISF - $LIC_PVS_ZCM_CFG -> $LIC_BISF_ZCM_CFG 20 | 06.10.2015 MS: rewritten script with standard .SYNOPSIS 21 | 12.03.2017 MS: using $LIC_BISF_CLI_ZCM to configure ZCM with ADMX 22 | 29.10.2017 MS: replace $DiskMode -eq "VDAShared", instead of MCSShared 23 | 24 | .LINK 25 | https://eucweb.com 26 | #> 27 | 28 | Begin { 29 | $Product = "Novell ZCM Agent" 30 | $servicename = "Novell ZENworks Agent Service" 31 | $ZCMConfigPath = "$PVSDiskDrive\ZCM\" 32 | $ZCMConfigFiles = "DeviceData", "DeviceGUID", "initial-web-service" 33 | $PSScriptFullName = $MyInvocation.MyCommand.Path 34 | $PSScriptRoot = Split-Path -Parent $PSScriptFullName 35 | $PSScriptName = [System.IO.Path]::GetFileName($PSScriptFullName) 36 | } 37 | 38 | Process { 39 | 40 | #################################################################### 41 | ####### functions ##### 42 | #################################################################### 43 | function CheckConfigFiles { 44 | $result = $true 45 | foreach ($file in $ZCMConfigFiles) { 46 | if (!(Test-Path -Path $ZcmConfigPath$file -PathType Leaf)) { 47 | $result = $false 48 | } 49 | } 50 | return $result 51 | } 52 | 53 | #################################################################### 54 | 55 | #### Main Program 56 | $svc = Test-BISFService -ServiceName "$servicename" -ProductName "$product" 57 | IF ($svc -eq $true) { 58 | # Check Disk Mode 59 | $DiskMode = Get-BISFDiskMode 60 | 61 | 62 | if (($DiskMode -eq "ReadOnly") -or ($DiskMode -eq "VDAShared")) { 63 | Write-BISFLog -Msg "vDisk in Standard Mode, Processing ZCM Agent" 64 | if (!(CheckConfigFiles)) { 65 | Write-BISFLog -Msg "ZCM Config Files not valid, Clean Directory $ZCMConfigPath" -Type W -SubMsg 66 | Get-ChildItem $ZCMConfigPath | Remove-Item -Force -ErrorAction SilentlyContinue 67 | 68 | Write-BISFLog -Msg "Starting ZCM Agent" 69 | Start-Service -Name 'Novell ZENworks Agent Service' -PassThru 70 | 71 | Write-BISFLog -Msg "Registering ZCM Agent with Arguments $LIC_BISF_CLI_ZCM" 72 | Start-Process -FilePath "$ProgramFilesx86\Novell\ZENworks\bin\zac.exe" -ArgumentList $LIC_BISF_CLI_ZCM 73 | 74 | # Wait 3 Minutes before File Backup 75 | sleep -Seconds 180 76 | 77 | Write-BISFLog -Msg "Backup Config Files to $ZCMConfigPath" 78 | foreach ($file in $ZCMConfigFiles) { 79 | Copy-Item -Path "$ProgramFilesx86\Novell\ZENworks\conf\$file" -Destination $ZCMConfigPath -Force 80 | } 81 | 82 | } 83 | else { 84 | Write-BISFLog -Msg "Valid Backup Date Found in $ZCMConfigPath, Restoring" 85 | Get-ChildItem $ZCMConfigPath | Copy-Item -Destination "$ProgramFilesx86\Novell\ZENworks\conf" -Force 86 | 87 | Write-BISFLog -Msg "Starting ZCM Agent" 88 | Start-Service -Name 'Novell ZENworks Agent Service' -PassThru 89 | 90 | } 91 | } 92 | else { 93 | Write-BISFLog -Msg "vDisk in not in Standard Mode ($DiskMode), Skipping ZCM Agent preparation" -Type W -SubMsg 94 | } 95 | 96 | } 97 | 98 | } 99 | End { 100 | Add-BISFFinishLine 101 | } -------------------------------------------------------------------------------- /Framework/SubCall/Global/BISF.psd1: -------------------------------------------------------------------------------- 1 | # 2 | # Module manifest for module 'PSGet_BISF' 3 | # 4 | # Generated by: Matthias Schlimm 5 | # 6 | # Generated on: 11/19/2022 7 | # 8 | 9 | @{ 10 | 11 | # Script module or binary module file associated with this manifest. 12 | RootModule = 'BISF.psm1' 13 | 14 | # Version number of this module. 15 | ModuleVersion = '7.1912.7' 16 | 17 | # Supported PSEditions 18 | # CompatiblePSEditions = @() 19 | 20 | # ID used to uniquely identify this module 21 | GUID = '632e959f-fff8-40ee-96f4-d8fb3f122a9f' 22 | 23 | # Author of this module 24 | Author = 'Matthias Schlimm' 25 | 26 | # Company or vendor of this module 27 | CompanyName = 'EUCweb' 28 | 29 | # Copyright statement for this module 30 | Copyright = '(c) 2020 Eucweb' 31 | 32 | # Description of the functionality provided by this module 33 | # Description = '' 34 | 35 | # Minimum version of the Windows PowerShell engine required by this module 36 | PowerShellVersion = '2.0' 37 | 38 | # Name of the Windows PowerShell host required by this module 39 | # PowerShellHostName = '' 40 | 41 | # Minimum version of the Windows PowerShell host required by this module 42 | # PowerShellHostVersion = '' 43 | 44 | # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. 45 | # DotNetFrameworkVersion = '' 46 | 47 | # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. 48 | # CLRVersion = '' 49 | 50 | # Processor architecture (None, X86, Amd64) required by this module 51 | # ProcessorArchitecture = '' 52 | 53 | # Modules that must be imported into the global environment prior to importing this module 54 | # RequiredModules = @() 55 | 56 | # Assemblies that must be loaded prior to importing this module 57 | # RequiredAssemblies = @() 58 | 59 | # Script files (.ps1) that are run in the caller's environment prior to importing this module. 60 | # ScriptsToProcess = @() 61 | 62 | # Type files (.ps1xml) to be loaded when importing this module 63 | # TypesToProcess = @() 64 | 65 | # Format files (.ps1xml) to be loaded when importing this module 66 | # FormatsToProcess = @() 67 | 68 | # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess 69 | # NestedModules = @() 70 | 71 | # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. 72 | FunctionsToExport = '*' 73 | 74 | # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. 75 | CmdletsToExport = '@()' 76 | 77 | # Variables to export from this module 78 | # VariablesToExport = @() 79 | 80 | # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. 81 | AliasesToExport = @() 82 | 83 | # DSC resources to export from this module 84 | # DscResourcesToExport = @() 85 | 86 | # List of all modules packaged with this module 87 | # ModuleList = @() 88 | 89 | # List of all files packaged with this module 90 | # FileList = @() 91 | 92 | # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. 93 | PrivateData = @{ 94 | 95 | PSData = @{ 96 | 97 | # Tags applied to this module. These help with module discovery in online galleries. 98 | # Tags = @() 99 | 100 | # A URL to the license for this module. 101 | # LicenseUri = '' 102 | 103 | # A URL to the main website for this project. 104 | # ProjectUri = '' 105 | 106 | # A URL to an icon representing this module. 107 | # IconUri = '' 108 | 109 | # ReleaseNotes of this module 110 | # ReleaseNotes = '' 111 | 112 | # External dependent modules of this module 113 | # ExternalModuleDependencies = '' 114 | 115 | } # End of PSData hashtable 116 | 117 | } # End of PrivateData hashtable 118 | 119 | # HelpInfo URI of this module 120 | HelpInfoURI = 'https://eucweb.com' 121 | 122 | # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. 123 | DefaultCommandPrefix = 'BISF' 124 | 125 | } 126 | 127 | -------------------------------------------------------------------------------- /Framework/SubCall/Personalization/10_PersBISF_OfficeKMS.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Activate Office against the KMS server 4 | .DESCRIPTION 5 | .EXAMPLE 6 | .NOTES 7 | Author: Matthias Schlimm 8 | Company: EUCWeb.com 9 | 10 | History: 11 | 13.01.2015 BR: Script created for Office 2010 and Office 2013 12 | 06.10.2015 MS: Rewritten script with standard .SYNOPSIS 13 | 07.12.2016 MS: Added Office 2016 support 14 | 01.11.2017 MS: get Office activation state and License state back to the BIS-F log 15 | 22.03.2018 MS: Feature 15 - support for Office 365 ClicktoRun 16 | 28.03.2019 MS: FRQ 86 - Office 2019 support 17 | 03.10.2019 MS: ENH 84 - if hosting on azure, Displays the device join status 18 | 07.01.2020 MS: HF 174 - Office detection general change 19 | 18.02.2020 JK: Fixed Log output spelling 20 | 01.08.2020 MS: HF 269 - Office detection takes too long, using reg instead of WMI 21 | 02.08.2020 MS: HF 270 - PersBISF_Start.ps1 Script Causing all installed Applications to Reconfigure 22 | 23 | .LINK 24 | https://eucweb.com 25 | #> 26 | 27 | 28 | Begin { 29 | $script_path = $MyInvocation.MyCommand.Path 30 | $script_dir = Split-Path -Parent $script_path 31 | $script_name = [System.IO.Path]::GetFileName($script_path) 32 | } 33 | 34 | Process { 35 | 36 | # Check Office installation 37 | $OfficeProducts = @("Microsoft Office Professional Plus","Microsoft Office Standard","Click-to-Run Licensing Component") 38 | [array]$OfficeInstallRoot = $null 39 | ForEach ($OfficeProduct in $OfficeProducts) { 40 | $Office = (Get-BISFSoftwareInfo -Publisher "Microsoft" -Name "$OfficeProduct")[-1] | select DisplayVersion,DisplayName 41 | IF ($null -ne $Office) { 42 | $OFName = $Office.DisplayName 43 | $OFVersion = $Office.DisplayVersion #Version : 16.0.4266.1001 44 | $OFVersionShort = $OFVersion.substring(0, 4) #Version : 16.0 45 | IF ($OFName -like "*Click-to-Run*") { $O365 = $true } ELSE { $O365 = $false } 46 | Write-BISFLog -Msg "$OFName - $OFVersion installed" -ShowConsole -Color Cyan 47 | IF ($O365 -eq $false) { 48 | If ([Environment]::Is64BitOperatingSystem) { 49 | $OfficeInstallRoot += (Get-ItemProperty -Path Registry::HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\$($OFVersionShort)\Common\InstallRoot -Name Path -ErrorAction SilentlyContinue).Path 50 | } 51 | If ($OfficeInstallRoot -isnot [system.object]) { $OfficeInstallRoot += (Get-ItemProperty -Path Registry::HKLM\SOFTWARE\Microsoft\Office\$($OFVersionShort)\Common\InstallRoot -Name Path -ErrorAction SilentlyContinue).Path } 52 | } ELSE { 53 | If ([Environment]::Is64BitOperatingSystem) { 54 | $OfficeInstallRoot += (Get-ItemProperty -Path Registry::HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\ClickToRun -Name InstallPath -ErrorAction SilentlyContinue).InstallPath 55 | } 56 | If ($OfficeInstallRoot -isnot [system.object]) { $OfficeInstallRoot += (Get-ItemProperty -Path Registry::HKLM\SOFTWARE\Microsoft\Office\ClickToRun -Name InstallPath -ErrorAction SilentlyContinue).InstallPath } 57 | } 58 | 59 | Write-BISFLog -Msg "Installpath $OfficeInstallRoot " -ShowConsole -Color DarkCyan -SubMsg 60 | $OSPP = Get-ChildItem -Path $OfficeInstallRoot -filter "OSPP.vbs" -Recurse -ErrorAction SilentlyContinue | ForEach-Object { $_.FullName } 61 | Write-BISFLog -Msg "OSPP is installed in $OSPP" 62 | 63 | Write-BISFLog -Msg "Activating Office against KMS" -Color DarkCyan -SubMsg 64 | # Activate the office version 65 | Start-BISFProcWithProgBar -ProcPath "$env:windir\system32\cscript.exe" -Args "//NoLogo ""$OSPP"" /act" -ActText "Start triggering activation" 66 | Start-BISFProcWithProgBar -ProcPath "$env:windir\system32\cscript.exe" -Args "//NoLogo ""$OSPP"" /dstatus" -ActText "Get Office Licensing state" 67 | 68 | $O365onAzure = Test-BISFAzureVM 69 | IF ($O365onAzure -eq $true) { 70 | Write-BISFLog -Msg "Office is hosted on Microsoft Azure VM" -ShowConsole -Color DarkCyan -SubMsg 71 | Start-BISFProcWithProgBar -ProcPath "$env:windir\system32\dsregcmd.exe" -Args "/status" -ActText "Office - Displays the device join status" 72 | } 73 | ELSE { 74 | Write-BISFLog -Msg "Office is NOT hosted on a Microsoft Azure VM" -Color DarkCyan -SubMsg 75 | } 76 | 77 | } ELSE { 78 | Write-BISFLog "$OfficeProduct is NOT installed" 79 | } 80 | } 81 | 82 | IF ($null -eq $OfficeInstallRoot ) { 83 | Write-BISFLog -Msg "No Office installation detected" -Type W 84 | } 85 | 86 | } 87 | 88 | End { 89 | Add-BISFFinishLine 90 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_AV-WinDefend.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare Microsoft Windows Defender for Image Management 4 | .DESCRIPTION 5 | Reconfigure Microsoft Windows Defender 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm, Florian Frank 9 | 10 | History: 11 | 25.03.2014 MS: Script created 12 | 01.04.2014 MS: Changed console message 13 | 12.05.2014 MS: Changed Fullscan from Windows Defender directory to '$ProductPath\...' 14 | 13.05.2014 MS: Added Silentswitch -AVFullScan (YES|NO) 15 | 11.06.2014 MS: Syntax error to start silent pattern update and full scan, fix read variable LIC_BISF_CLI_AV 16 | 13.08.2014 MS: Removed $logfile = Set-logFile, it would be used in the 10_XX_LIB_Config.ps1 Script only 17 | 20.02.2015 MS: Added progress bar during full scan 18 | 30.09.2015 MS: Rewritten script with standard .SYNOPSIS, use central BISF function to configure service 19 | 06.03.2017 MS: Bugfix read Variable $varCLI = ... 20 | 31.05.2017 FF: Added changes necessary to prepare Windows Defender and create a seperate script 21 | 08.01.2017 JP: Replaced "C:\Program Files" with windows variable, fixed typos 22 | 02.08.2017 MS: to much " at the end of Line 44, breaks script to fail 23 | 17.08.2017 FF: Program is named "Windows Defender", not "Microsoft Windows Defender", fixed typos 24 | 08.09.2017 FF: Feature 182 - Windows Defender Signature will only be updated if Defender is enabled to run 25 | 20.10.2018 MS: Bugfix 55: Windows Defender -ArgumentList failing 26 | 14.08.2019 MS: FRQ 3 - Remove Messagebox and using default setting if GPO is not configured 27 | 03.10.2019 MS: ENH 51 - ADMX Extension: select AnitVirus full scan or custom Scan arguments 28 | 21.11.2020 MS: HF 284 - MPCmdRun Process monitor with the current user only, exclude other accounts 29 | 30 | .LINK 31 | https://eucweb.com 32 | .LINK 33 | https://docs.microsoft.com/en-us/windows/threat-protection/windows-defender-antivirus/deployment-vdi-windows-defender-antivirus 34 | .LINK 35 | https://docs.microsoft.com/en-us/windows/threat-protection/windows-defender-antivirus/command-line-arguments-windows-defender-antivirus 36 | #> 37 | 38 | Begin { 39 | $PSScriptFullName = $MyInvocation.MyCommand.Path 40 | $PSScriptRoot = Split-Path -Parent $PSScriptFullName 41 | $PSScriptName = [System.IO.Path]::GetFileName($PSScriptFullName) 42 | $Product = "Windows Defender" 43 | $ProductPath = "${env:ProgramFiles}\$Product" 44 | $ServiceName = 'WinDefend' 45 | } 46 | 47 | Process { 48 | 49 | function MSCrun { 50 | Write-BISFLog -Msg "Check GPO Configuration" -SubMsg -Color DarkCyan 51 | $varCLI = $LIC_BISF_CLI_AV 52 | 53 | If (($varCLI -eq "YES") -or ($varCLI -eq "NO")) { 54 | Write-BISFLog -Msg "GPO Valuedata: $varCLI" 55 | } 56 | Else { 57 | Write-BISFLog -Msg "GPO not configured.. using default setting" -SubMsg -Color DarkCyan 58 | $AVScan = "YES" 59 | } 60 | 61 | If (($AVScan -eq "YES" ) -or ($varCLI -eq "YES")) { 62 | Write-BISFLog -Msg "Updating virus signatures... please wait" 63 | Start-Process -FilePath "$ProductPath\MpCMDrun.exe" -ArgumentList "-SignatureUpdate" -WindowStyle Hidden 64 | $procID = (Get-Process -Name "MpCMDrun" | ? { $_.SI -eq (Get-Process -PID $PID).SessionId }).Id # get MPCmdRun for the current user only 65 | Show-BISFProgressBar -CheckProcessId $procID -ActivityText "$Product is updating the virus signatures...please wait" 66 | 67 | IF ($LIC_BISF_CLI_AV_VIE_CusScanArgsb -eq 1) { 68 | Write-BISFLog -Msg "Enable Custom Scan Arguments" 69 | $args = $LIC_BISF_CLI_AV_VIE_CusScanArgs 70 | } 71 | ELSE { 72 | $args = "-scan -scantype 2" 73 | } 74 | 75 | Write-BISFLog -Msg "Running Scan with arguments: $args" 76 | Start-Process -FilePath "$ProductPath\MpCMDrun.exe" -ArgumentList $args -WindowStyle Hidden 77 | Show-BISFProgressBar -CheckProcess "MpCMDrun" -ActivityText "$Product is scanning the system...please wait" 78 | } 79 | Else { 80 | Write-BISFLog -Msg "No Scan will be performed" 81 | } 82 | } 83 | 84 | #################################################################### 85 | ####### End functions ##### 86 | #################################################################### 87 | 88 | #### Main Program 89 | If (Test-BISFService -ServiceName $ServiceName) { 90 | If ((Get-Service -Name $ServiceName).Status -eq 'Running') { 91 | Write-BISFLog -Msg "$Product is installed and activated" -ShowConsole -Color Cyan 92 | MSCrun 93 | } 94 | Else { 95 | Write-BISFLog -Msg "$Product is installed, but not activated" 96 | } 97 | } 98 | Else { 99 | Write-BISFLog -Msg "$Product is not installed" 100 | } 101 | 102 | } 103 | 104 | End { 105 | Add-BISFFinishLine 106 | } -------------------------------------------------------------------------------- /PrepareBaseImage.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM ********************************************* 3 | REM * * 4 | REM * Prepare your BaseImage * 5 | REM * * 6 | REM * * 7 | REM * Created : 27.02.2013 * 8 | REM * Author: Matthias Schlimm * 9 | REM * Website: EUCweb.com * 10 | REM ********************************************* 11 | REM Comments: 12 | REM Prepare your Base Image for Microsoft, VMware and Citrix Environments 13 | 14 | PushD "%~dp0" 15 | color 17 16 | mode con: cols=190 lines=60 17 | echo initialize script environment... please wait 18 | SET Files.PT=%~dp0framework 19 | Powershell.exe -command "set-executionpolicy bypass" >NUL 20 | echo Administrative permissions required. Detecting permissions... 21 | net session >nul 2>&1 22 | if %errorLevel% == 0 ( 23 | echo Success: Administrative permissions confirmed. 24 | Powershell.exe -WindowStyle Maximize -file "%Files.PT%\PrepBISF_Start.ps1" 25 | REM Note: For silent automation please use the additional ADMX template in the BIS-F installation folder and copy them to your PolicyDefintions folder 26 | ) else ( 27 | color 4F 28 | echo Failure: Current permissions inadequate. 29 | echo Close this window and run with aministrative permissions again !! 30 | pause >nul 31 | ) 32 | 33 | PopD 34 | 35 | REM History: 36 | REM 27.02.2013 MS: Script created 37 | REM 17.09.2013 MS: @echo off and set Windows Title 38 | REM 10.03.2014 MS: Changed Console Windows Size mode con: cols=120 lines=60 39 | REM 19.03.2014 MS: Changed Console Windows Size mode con: cols=160 lines=60 40 | REM 21.03.2014 MS: Changed Console Windows Size mode con: cols=190 lines=80 41 | REM 26.03.2014 MS: Changed Console Windows Size mode con: cols=190 lines=60 42 | REM 01.04.2014 MS: Removed title 43 | REM 13.05.2014 MS: Added silent mode parameters 44 | REM 11.06.2014 MS: Changed ExecutionPolicy from unrestricted to RemoteSigned 45 | REM 06.08.2014 MS: Supressed message for set-executionpolicy remoteSigned 46 | REM 14.08.2014 MS: Changed name from PrepareXAforPVS.cmd to PrepareBaseImage.cmd 47 | REM 17.08.2014 MS: Added CLI command for Citrix Personal vDisk 48 | REM 10.02.2015 MS: Added CLI command for CCleaner to clean temp files 49 | REM 10.02.2015 MS: Added Smanytec Endpoint Protection VIEScan silent option to flag the scanned files 50 | REM 13.02.2015 MS: Added CLI command Reset Performance Counters 'RstPerfCnt'' 51 | REM 15.04.2015 MS: Added CLI command to shutdown or not the Base Image after successfull convert -shutdown NO (if script running from MDT or SCCM shutdown would be suppressed) 52 | REM 28.05.2015 MS: Added CLI command 'VerySilent' to suppress all MessageBoxes 53 | REM 03.06.2015 MS: Added CLI command 'FSXdelRules' to purge the FSLogix Rules from CLI 54 | REM 13.08.2015 MS: Added CLI command 'FSXRulesShare' to define fsLogix central rules share, to copy frx and fra files on computerstartup 55 | REM 21.08.2015 MS: Change Request 77 - remove all XX,XA,XD from al files and Scripts 56 | REM 04.11.2015 MS: Added CLI command 'delAllUsersStartmenu' to delete all Objects in C:\ProgramData\Microsoft\Windows\Start Menu\* 57 | REM 16.12.2015 MS: Added CLI command 'DisableIPv6' to disable IPv6 completly 58 | REM 07.01.2016 MS: Changed ExecutionPolicy from unrestricted to Bypass 59 | REM 10.03.2016 MS: Added CLI Switch 'DisableConsoleCheck' to disable the check of the Sessiontype 60 | REM 16.03.2016 MS: Added CLI command 'LogShare' to set Central LogShare 61 | REM 17.03.2016 MS: Added CLI command 'TurboUpdate' to update Turbo.net Supscription on system startup 62 | REM 17.03.2016 MS: Added CLI command 'DelProf' to delete unused profiles, delprof2.exe must be download first and save in the BIS-F Tools Folder 63 | REM 06.10.2016 MS: Change 10_MAIN_PrepBISF.ps1 to PrepBISF_Start.ps1, global architectural change 64 | REM 23.11.2016 MS: Added CLI command 'vmOSOT' to run Vmware OS Optimization Tool with default template, if detected in any folder on the local system (drive c: only) 65 | REM 23.11.2016 MS: Added CLI command 'WEMAgentBrokerName' to set the Citrix Workspace Environment Agent BrokerName if not configured via GPO 66 | REM 06.12.2016 MS: WindowStyle Maximize 67 | REM 10.01.2017 MS: Added CLI command 'XAImagePrepRemoval' during Prepare XenApp for Provisioning/Image Management you can choose RemoveCurrentServer and ClearLocalDatabaseInformation, this would be set with this Parameter or prompted to administrator to choose 68 | REM 10.01.2017 MS: Added CLI command 'AppVPckRemoval' to delete PreCached App-V packages 69 | REM 11.01.2017 MS: Added Cli command 'RESWASdisableBaseImage' to disable RES ONE Automation Agent on Base Image only to prevent RES ONE License usage for your Base Iamges 70 | REM 02.02.2017 MS: Remove CLI command, using ADMX ADMX-File in the BIS-F installation folder and copy them to your PolicyDefintions 71 | REM 21.02.2017 MS: checking admin privileges before run script 72 | REM ********************************************* -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_CMTrace.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare CMTrace.exe as LogFileViewer 4 | .DESCRIPTION 5 | Search for existing CMTrace.exe on system and use this one, or copy that to the system and register *.bis with the CMtarce LogfileViewer 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History: 12 | 11.08.2014 MS: Script created 13 | 12.08.2014 MS: Change Extension from .log to .bis (BIS = BaseImageScripts) 14 | 13.08.2014 MS: remove $logfile = Set-logFile, it would be used in the 10_XX_LIB_Config.ps1 Script only 15 | 13.08.2014 MS: Check if not exists C:\Windows\trace32.exe 16 | 15.08.2014 MS: suppress pupup for current user to register viewer for all *.log files 17 | 15.04.2015 MS: replace trace32 with CMtrace latest version 18 | 15.04.2015 MS: copy CMtrace only, if trace32 or cmtrace not exist on the system. register extension *.bis with the available Viewer on the system (trace32 or cmtrace) 19 | 12.08.2015 MS: search on specified path and their subfolders only, for a better performance 20 | 30.09.2015 MS: rewritten script with standard .SYNOPSIS, use central BISF function to configure service 21 | 10.11.2016 MS: CMTrace would not longer distributed by BIS-F, customer must have them in their environment installed 22 | 21.09.2017 MS: using custom searchfolder from ADMX if enabled 23 | 13.08.2019 MS: ENH 121 - change filenameextension from bis to log 24 | 18.02.2020 JK: Fixed Log output spelling 25 | 26 | .LINK 27 | https://eucweb.com 28 | #> 29 | 30 | Begin { 31 | $PSScriptFullName = $MyInvocation.MyCommand.Path 32 | $PSScriptRoot = Split-Path -Parent $PSScriptFullName 33 | $PSScriptName = [System.IO.Path]::GetFileName($PSScriptFullName) 34 | 35 | $AppName = "CMTrace" 36 | $reg_hklm_classes = "$hklm_software\Classes" 37 | $reg_Hkcu_classes = "$hkcu_software\Classes" 38 | $reg_LogFile = "BIS.File\shell\open\command" 39 | $reg_log = ".log" 40 | $reg_lo = ".lo_" 41 | $found = $false 42 | IF ($LIC_BISF_CLI_OT_SF -eq "1") { 43 | $SMSSearchFolders = $LIC_BISF_CLI_OT_SF_CUS 44 | } 45 | ELSE { 46 | $SMSSearchFolders = @("C:\Windows", "C:\Windows\system32", "$env:ProgramFiles", "$env:Programfiles(x86)") 47 | } 48 | } 49 | 50 | Process { 51 | 52 | $varCLI = $LIC_BISF_CLI_CM 53 | IF (!($varCLI -eq "NO") -or ($varCLI -eq $null)) { 54 | Write-BISFLog -Msg "Searching for Logfileviewer ($AppName)" 55 | ForEach ($SMSSearchFolder in $SMSSearchFolders) { 56 | If ($found -eq $false) { 57 | Write-BISFLog -Msg "Looking in $SMSSearchFolder" 58 | $CMTRaceExists = Get-ChildItem -Path "$SMSSearchFolder" -filter "CMTrace.exe" -ErrorAction SilentlyContinue | Where-Object { $_.FullName -notlike "*Tools\*" } | ForEach-Object { $_.FullName } 59 | 60 | IF (($CMTRaceExists -ne $null) -and ($found -ne $true)) { 61 | $SMSTraceDestination = $CMTRaceExists 62 | Write-BISFLog -Msg "Product $($AppName) installed" -ShowConsole -Color Cyan 63 | $found = $true 64 | 65 | Write-BISFLog -Msg "Register $SMSTraceDestination as the default Log viewer for extension $reg_log" -SubMsg -Color DarkCyan 66 | New-Item -Path $reg_hklm_classes -Name $reg_LogFile -Force -ErrorAction SilentlyContinue | Out-Null 67 | New-Item -Path $reg_hklm_classes -Name $reg_Log -Force -ErrorAction SilentlyContinue | Out-Null 68 | New-Item -Path $reg_hklm_classes -Name $reg_Lo -Force -ErrorAction SilentlyContinue | Out-Null 69 | 70 | Set-Item -Path "$reg_hklm_classes\$reg_LogFile" -value "$SMSTraceDestination %1" -ErrorAction SilentlyContinue | Out-Null 71 | Set-Item -Path "$reg_hklm_classes\$reg_Log" -value "BIS.File" -ErrorAction SilentlyContinue | Out-Null 72 | Set-Item -Path "$reg_hklm_classes\$reg_Lo" -value "BIS.File" -ErrorAction SilentlyContinue | Out-Null 73 | 74 | New-Item -Path $reg_hkcu_classes -Name $reg_LogFile -Force -ErrorAction SilentlyContinue | Out-Null 75 | New-Item -Path $reg_hkcu_classes -Name $reg_Log -Force -ErrorAction SilentlyContinue | Out-Null 76 | New-Item -Path $reg_hkcu_classes -Name $reg_Lo -Force -ErrorAction SilentlyContinue | Out-Null 77 | 78 | Set-Item -Path "$reg_hkcu_classes\$reg_LogFile" -value "$SMSTraceDestination %1" -ErrorAction SilentlyContinue | Out-Null 79 | Set-Item -Path "$reg_hkcu_classes\$reg_Log" -value "BIS.File" -ErrorAction SilentlyContinue | Out-Null 80 | Set-Item -Path "$reg_hkcu_classes\$reg_Lo" -value "BIS.File" -ErrorAction SilentlyContinue | Out-Null 81 | 82 | #supress popup for current user if start the logviewer 83 | New-Item -Path "$hkcu_software\Microsoft" -Name "$AppName" -Force -ErrorAction SilentlyContinue | Out-Null 84 | Set-ItemProperty -Path "$hkcu_software\Microsoft\$AppName" -Name "Register File Types" -value "0" -ErrorAction SilentlyContinue | Out-Null 85 | } 86 | } 87 | } 88 | } 89 | ELSE { 90 | Write-BISFLog -Msg "Skip searching and register $AppName" 91 | } 92 | } 93 | 94 | End { 95 | If ($found -eq $false) { Write-BISFLog -Msg "Product $($AppName) is NOT installed" } 96 | Add-BISFFinishLine 97 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_vmOSOT.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | <# 3 | .SYNOPSIS 4 | Running VMware OS Optimization Tool with default template 5 | .DESCRIPTION 6 | search for existing VMwareOSOptimizationTool*.exe on system and use this one with default OS template 7 | .EXAMPLE 8 | .NOTES 9 | Author: Matthias Schlimm 10 | 11 | History: 12 | 23.11.2016 MS: Script created 13 | Last Chnage: 06.12.2016 MS: Created folder if not exist -> $vmOSOTtemplatePath 14 | 24.01.2017 MS: For faster search replaced $SearchFolders = @("C:") with $SearchFolders = @("C:\Program Files","C:\Program Files (x86)","C:\Windows\system32") 15 | 28.01.2017 MS: Changed notice from CLI to ADMX 16 | 06.03.2017 MS: Bugfix read Variable $varCLI = ... 17 | 01.08.2017 MS: using custom searchfolder from ADMX if enabled 18 | 01.08.2017 MS: specify OS template in ADMX 19 | 04.08.2017 MS: Bugfix IF (!("$LIC_BISF_CLI_OT_Templ" -eq "") ) 20 | 07.11.2017 MS: enable 3rd Party Optimizations, if vmOSOT is executed, this disabled BIS-F own optimizations 21 | 14.08.2019 MS: FRQ 3 - Remove Messagebox and using default setting if GPO is not configured 22 | 18.02.2020 JK: Fixed Log output spelling 23 | 24 | .LINK 25 | https://eucweb.com 26 | #> 27 | 28 | 29 | Begin { 30 | 31 | $PSScriptFullName = $MyInvocation.MyCommand.Path 32 | $PSScriptRoot = Split-Path -Parent $PSScriptFullName 33 | $PSScriptName = [System.IO.Path]::GetFileName($PSScriptFullName) 34 | IF ($LIC_BISF_CLI_OT_SF -eq "1") { 35 | $SearchFolders = $LIC_BISF_CLI_OT_SF_CUS 36 | } 37 | ELSE { 38 | $SearchFolders = @("C:\Program Files", "C:\Program Files (x86)", "C:\Windows\system32") 39 | } 40 | 41 | IF (!($LIC_BISF_CLI_OT_Templ -eq "") ) { 42 | $vmTemplateFullPath = "$($LIC_BISF_CLI_OT_Templ)" 43 | } 44 | ELSE { 45 | $vmTemplateFullPath = "" 46 | } 47 | 48 | $AppName = "VMware OS Optimization Tool (vmOSOT)" 49 | $vmOSOTtemplatePath = "C:\ProgramData\VMware\OSOT\VMware Templates" 50 | $found = $false 51 | $tmpCMD = "C:\Windows\temp\vmOSOT.cmd" 52 | } 53 | 54 | 55 | Process { 56 | $varCLI = $LIC_BISF_CLI_OT 57 | IF (!($varCLI -eq "NO")) { 58 | Write-BISFLog -Msg "Searching for $AppName on local System" -ShowConsole -Color Cyan 59 | Write-BISFLog -Msg "This can run for a long time based on the size of your root drive, you can skip this in the ADMX configuration (3rd Party Tools)" -ShowConsole -Color DarkCyan 60 | ForEach ($SearchFolder in $SearchFolders) { 61 | If ($found -eq $false) { 62 | Write-BISFLog -Msg "Looking in $SearchFolder" 63 | $FileExists = Get-ChildItem -Path "$SearchFolder" -filter "VMwareOSOptimizationTool*.exe" -Recurse -ErrorAction SilentlyContinue | % { $_.FullName } 64 | 65 | IF (($FileExists -ne $null) -and ($found -ne $true)) { 66 | 67 | Write-BISFLog -Msg "Product $($AppName) installed" -ShowConsole -Color Cyan 68 | $found = $true 69 | 70 | Write-BISFLog -Msg "Check GPO Configuration" -SubMsg -Color DarkCyan 71 | 72 | IF (($varCLI -eq "YES") -or ($varCLI -eq "NO")) { 73 | Write-BISFLog -Msg "GPO Valuedata: $varCLI" 74 | } 75 | ELSE { 76 | Write-BISFLog -Msg "Silentswitch not defined, show MessageBox" 77 | Write-BISFLog -Msg "GPO not configured.. using default setting" -SubMsg -Color DarkCyan 78 | $VMOptTool = "No" 79 | } 80 | 81 | If (($VMOptTool -eq "YES" ) -or ($varCLI -eq "YES")) { 82 | Write-BISFLog -Msg "Running $AppName... please Wait" 83 | Write-BISFLog -Msg "Create temporary CMD-File ($tmpCMD) to run $AppName from them" 84 | """$FileExists"" -r $LogFilePath" | Out-File $tmpCMD -Encoding default 85 | IF (!($vmTemplateFullPath -eq "")) { 86 | """$FileExists"" -o -t ""$($vmTemplateFullPath)"" -v > C:\Windows\Logs\VMwOsOptTool.log" | Out-File $tmpCMD -Encoding default -Append 87 | } 88 | ELSE { 89 | """$FileExists"" -o -v > C:\Windows\Logs\VMwOsOptTool.log" | Out-File $tmpCMD -Encoding default -Append 90 | } 91 | 92 | 93 | if (!(Test-Path -Path $vmOSOTtemplatePath)) { 94 | Write-BISFLog -Msg "Createing Directory $vmOSOTtemplatePath" 95 | New-Item -Path $vmOSOTtemplatePath -ItemType Directory -Force 96 | } 97 | $Global:LIC_BISF_3RD_OPT = $true # BIS-F own optimization will be disabled, if 3rd Party Optimization is true 98 | Invoke-Expression -Command $tmpCMD | Out-Null 99 | Get-BISFLogContent -GetLogFile "C:\Windows\Logs\VMwOsOptTool.log" 100 | Remove-Item $tmpCMD -Force 101 | Write-BISFLog -Msg "The HTML-Report can be found on $LogFilePath" -ShowConsole -Color DarkCyan -SubMsg 102 | } 103 | ELSE { 104 | Write-BISFLog -Msg "No optimization performed by $AppName" 105 | } 106 | } 107 | } 108 | } 109 | } 110 | ELSE { 111 | Write-BISFLog -Msg "Skip searching and running $AppName" 112 | } 113 | } 114 | 115 | End { 116 | If ($found -eq $false) { Write-BISFLog -Msg "Product $($AppName) is NOT installed" } 117 | Add-BISFFinishLine 118 | } 119 | -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_AV-Sophos.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare Sophos AntiVirus for Image Managemement 4 | .DESCRIPTION 5 | Delete computer specific entries 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | 10 | History: 11 | 09.01.2017 MS: Script created 12 | 20.02.2017 MS: fix typos to get the right servicename -> $ServiceNames[0] 13 | 06.03.2017 MS: Bugfix read Variable $varCLI = ... 14 | 14.08.2019 MS: FRQ 3 - Remove Messagebox and using default setting if GPO is not configured 15 | 03.10.2019 MS: ENH 51 - ADMX Extension: select AnitVirus full scan or custom Scan arguments 16 | 18.02.2020 JK: Fixed Log output spelling 17 | 18 | .LINK 19 | https://eucweb.com 20 | #> 21 | 22 | Begin { 23 | $script_path = $MyInvocation.MyCommand.Path 24 | $script_dir = Split-Path -Parent $script_path 25 | $script_name = [System.IO.Path]::GetFileName($script_path) 26 | 27 | # Product specified 28 | $Product = "Sophos AntiVirus" 29 | $Inst_path = "$ProgramFilesx86\Sophos\Sophos Anti-Virus" 30 | $ServiceNames = @("Sophos Agent", "Sophos AutoUpdate Service", "Sophos Message Router") 31 | 32 | [array]$ToDelete = @( 33 | [pscustomobject]@{type = "REG"; value = "HKLM:\SOFTWARE\Wow6432Node\Sophos\Messaging System\Router\Private"; data = "pkc" }, 34 | [pscustomobject]@{type = "REG"; value = "HKLM:\SOFTWARE\Wow6432Node\Sophos\Messaging System\Router\Private"; data = "pkp" }, 35 | [pscustomobject]@{type = "REG"; value = "HKLM:\SOFTWARE\Wow6432Node\Sophos\Remote Management System\ManagementAgent\Private"; data = "pkc" }, 36 | [pscustomobject]@{type = "REG"; value = "HKLM:\SOFTWARE\Wow6432Node\Sophos\Remote Management System\ManagementAgent\Private"; data = "pkp" }, 37 | [pscustomobject]@{type = "FILE"; value = "C:\ProgramData\Sophos\AutoUpdate\data"; data = "machine_ID.txt" }, 38 | [pscustomobject]@{type = "FILE"; value = "C:\ProgramData\Sophos\AutoUpdate\data\status"; data = "status.xml" } 39 | ) 40 | } 41 | 42 | Process { 43 | 44 | #################################################################### 45 | ####### functions ##### 46 | #################################################################### 47 | 48 | function RunFullScan { 49 | 50 | Write-BISFLog -Msg "Check GPO Configuration" -SubMsg -Color DarkCyan 51 | $varCLI = $LIC_BISF_CLI_AV 52 | IF (($varCLI -eq "YES") -or ($varCLI -eq "NO")) { 53 | Write-BISFLog -Msg "GPO Valuedata: $varCLI" 54 | } 55 | ELSE { 56 | Write-BISFLog -Msg "GPO not configured.. using default setting" -SubMsg -Color DarkCyan 57 | $AVScan = "YES" 58 | } 59 | if (($AVScan -eq "YES" ) -or ($varCLI -eq "YES")) { 60 | IF ($LIC_BISF_CLI_AV_VIE_CusScanArgsb -eq 1) { 61 | Write-BISFLog -Msg "Enable Custom Scan Arguments" 62 | $args = $LIC_BISF_CLI_AV_VIE_CusScanArgs 63 | } 64 | ELSE { 65 | $args = "-f" 66 | } 67 | 68 | Write-BISFLog -Msg "Running Scan with arguments: $args" 69 | Start-Process -FilePath "$Inst_path\sav32cli.exe" -ArgumentList $args 70 | IF ($OSBitness -eq "32-bit") { $ScanProcess = "sav32cli" } ELSE { $ScanProcess = "sav32cli" } 71 | Show-BISFProgressBar -CheckProcess "$ScanProcess" -ActivityText "$Product is scanning the system...please wait" 72 | } 73 | ELSE { 74 | Write-BISFLog -Msg "No Scan will be performed" 75 | } 76 | 77 | } 78 | 79 | function deleteData { 80 | Write-BISFLog -Msg "Delete specified items " 81 | Foreach ($2Delete in $ToDelete) { 82 | IF ($2Delete.type -eq "REG") { 83 | Write-BISFLog -Msg "Processing Registry-Items to delete" -ShowConsole -SubMsg -color DarkCyan 84 | $Check2Delete = Test-BISFRegistryValue -Path $2Delete.value -Value $2Delete.data 85 | IF ($Check2Delete) { 86 | Write-BISFLog -Msg "Delete RegistryItem -Path($2Delete.value) -Name($2Delete.data)" 87 | Remove-ItemProperty -Path $2Delete.value -Name $2Delete.data -ErrorAction SilentlyContinue 88 | } 89 | } 90 | 91 | IF ($2Delete.type -eq "FILE") { 92 | Write-BISFLog -Msg "Processing Files to delete" -ShowConsole -SubMsg -color DarkCyan 93 | $File2Del = "$2Delete.value\$2Delete.data" 94 | IF (Test-Path ($File2Del) -PathType Leaf) { 95 | Write-BISFLog -Msg "Delete File $File2Del" 96 | Remove-Item $File2Del | Out-Null 97 | } 98 | } 99 | } 100 | } 101 | 102 | 103 | function StopService { 104 | ForEach ($ServiceName in $ServiceNames) { 105 | $svc = Test-BISFService -ServiceName "$ServiceName" 106 | IF ($svc -eq $true) { Invoke-BISFService -ServiceName "$($ServiceName)" -Action Stop -StartType manual } 107 | } 108 | } 109 | 110 | #################################################################### 111 | ####### end functions ##### 112 | #################################################################### 113 | 114 | #### Main Program 115 | $svc = Test-BISFService -ServiceName $ServiceNames[0] -ProductName "$product" 116 | IF ($svc -eq $true) { 117 | StopService 118 | RunFullScan 119 | deleteData 120 | } 121 | } 122 | 123 | End { 124 | Add-BISFFinishLine 125 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_ZCM.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding(SupportsShouldProcess = $true)] 2 | param( 3 | ) 4 | <# 5 | .SYNOPSIS 6 | Prepare ZCM Agent for Imaging on Base Image 7 | .DESCRIPTION 8 | .EXAMPLE 9 | .NOTES 10 | Author: Matthias Schlimm 11 | Company: EUCWeb.com 12 | 13 | History: 14 | 27.05.2015 MS: Script created 15 | 01.10.2015 MS: Rewritten script with standard .SYNOPSIS, use central BISF function to configure service 16 | 12.03.2017 MS: Change $tmparray=$LIC_BISF_ZCM_CFG to $tmparray=$LIC_BISF_CLI_ZCM to configure ZCM with ADMX 17 | 18.02.2020 JK: Fixed Log output spelling 18 | 19 | 20 | .LINK 21 | https://eucweb.com 22 | #> 23 | 24 | Begin { 25 | 26 | #################################################################### 27 | # define environment 28 | 29 | $script_path = $MyInvocation.MyCommand.Path 30 | $script_dir = Split-Path -Parent $script_path 31 | $script_name = [System.IO.Path]::GetFileName($script_path) 32 | 33 | # Product specified 34 | $Product = "Novell ZCM Agent" 35 | $product_path = $env:zenworks_home 36 | $servicename1 = "Novell ZENworks Agent Service" 37 | $servicename2 = "Novell Identity Store" 38 | $servicename3 = "nzwinvnc" 39 | $file1 = "$product_path\logs\preboot\novell-zisdservice.log" 40 | $file2 = "DeviceData", "DeviceGUID", "*.sav", "Guid.txt" 41 | $file3 = "initial-web-service" 42 | $folder1 = "$product_path\cache\zmd\" 43 | $reg_string1 = "$hklm_software\Wow6432Node\Novell\ZCM\PreAgent" 44 | $reg_string2 = "$hklm_software\Wow6432Node\Novell\ZCM\Remote Management\Agent" 45 | } 46 | 47 | Process { 48 | 49 | #################################################################### 50 | 51 | function PrepareAgent { 52 | 53 | If ($servicename1.Status -eq 'Running') { 54 | Write-BISFLog -Msg "$Product Service is running, execute specified zac commands" 55 | $tmparray = $LIC_BISF_ZCM_CFG 56 | Write-BISFLog -Msg "get username and password from configuration URL" 57 | $tmparray = $tmparray.split(" ") 58 | $cnt = 0 59 | ForEach ($tmp in $tmparray) { 60 | IF ($tmp -eq "-u") { 61 | $ZCMusrCmd = $tmparray[$cnt] 62 | $ZCMusrVal = $tmparray[$cnt + 1] 63 | $ZCMusr = $ZCMusrCmd + " " + $ZCMusrVal 64 | Write-BISFLog -Msg "ZCM User for CLI command $ZCMusr" 65 | } 66 | 67 | IF ($tmp -eq "-p") { 68 | $ZCMpwdCmd = $tmparray[$cnt] 69 | $ZCMpwdVal = $tmparray[$cnt + 1] 70 | $ZCMpwd = $ZCMpwdCmd + " " + $ZCMpwdVal 71 | Write-BISFLog -Msg "ZCM Password for CLI command ********" 72 | } 73 | $cnt++ 74 | } 75 | 76 | 77 | Start-Process "zac" -argumentlist "fsg -d" 78 | Start-Process "zac" -argumentlist "unr -f $ZCMusr $ZCMpwd" 79 | Start-Process "zac" -argumentlist "cc" 80 | 81 | } 82 | ## stop Novell services 83 | Invoke-BISFService -ServiceName "$servicename1" -Action Stop 84 | Invoke-BISFService -ServiceName "$servicename2" -Action Stop 85 | Invoke-BISFService -ServiceName "$servicename3" -Action Stop 86 | 87 | 88 | #delete needed files and registry entries 89 | if (Test-Path -Path $file1 -PathType Leaf) { 90 | Write-BISFLog -Msg "delete file $file1" 91 | Remove-Item -path "$file1" -force 92 | } 93 | ELSE { 94 | Write-BISFLog -Msg "file $file1 NOT exist" 95 | } 96 | 97 | foreach ($file in $file2) { 98 | if (Test-Path -Path "$product_path\conf\$file" -PathType Leaf) { 99 | Write-BISFLog -Msg "delete file $product_path\conf\$file" 100 | Remove-Item -path "$product_path\conf\$file" -force 101 | } 102 | ELSE { 103 | Write-BISFLog -Msg "file $product_path\conf\$file does NOT exist" 104 | } 105 | 106 | } 107 | Write-BISFLog -Msg "remove GUID from $reg_string1" 108 | Remove-ItemProperty -Path $reg_string1 -Name "GUID" -force -ErrorAction SilentlyContinue 109 | 110 | Write-BISFLog -Msg "remove all custom entries from $reg_string2" 111 | Remove-Item -Path $reg_string2 -Exclude *Default*, *Device* -Recurse -Force -ErrorAction SilentlyContinue 112 | 113 | Write-BISFLog -Msg "remove all items in folder $folder1" 114 | Remove-Item -Path $folder1 -Recurse -Force -ErrorAction SilentlyContinue 115 | 116 | Write-BISFLog -Msg "Wipes the ZISD data including the ZISD header, see https://www.novell.com/support/kb/doc.php?id=7007665" 117 | & "$product_path\bin\preboot\ZISWin.exe" "-w" 118 | 119 | if (Test-Path -Path "$product_path\conf\$file3.bak" -PathType Leaf) { 120 | 121 | if (Test-Path -Path "$product_path\conf\$file3" -PathType Leaf) { 122 | Write-BISFLog -Msg "remove file $product_path\conf\$file3" 123 | Remove-Item -path "$product_path\conf\$file3" -force 124 | } 125 | Write-BISFLog -Msg "rename file $product_path\conf\$file3.bak" 126 | Rename-Item -path "$product_path\conf\$file3.bak" -newname "$product_path\conf\$file3" -Force 127 | } 128 | ELSE { 129 | Write-BISFLog -Msg "file $product_path\conf\$file3.bak NOT exist" 130 | } 131 | 132 | 133 | } 134 | 135 | #### Main Program 136 | 137 | $svc = Test-BISFService -ServiceName "$servicename1" -ProductName "$product" 138 | IF ($svc -eq $true) { 139 | PrepareAgent 140 | } 141 | 142 | } 143 | 144 | End { 145 | Add-BISFFinishLine 146 | } -------------------------------------------------------------------------------- /Framework/SubCall/Personalization/10_PersBISF_AV-SEP.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepapre Symantec Endpoint Protection for Image Managemement Software 4 | .DESCRIPTION 5 | Create HostID based on MACAddress 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History: 12 | 24.09.2012 MS: Script created 13 | 18.09.2013 MS: replace $date with $(Get-date) to get current timestamp at running scriptlines write to the logfile 14 | 18.09.2013 MS: replace $PVsWriteCacheDisk to global environment variable $LIC_PVS_HostIDPath 15 | 17.12.2013 MS: change service to smc -start for SEP 12 or higher 16 | 27.01.2014 MS: $HostID_Prfx = "00000000000000000000" 17 | 27.01.2014 MS: Set-Location $SEP_path 18 | 28.01.2014 MS: $service_name = "cmd /c smc -start" 19 | 28.01.2014 MS: $reg_SEP_name 20 | 10.03.2014 MS: Review Code 21 | 11.03.2014 MS: IF (Test-Path ("$SEP_path\smc.exe")) 22 | 18.03.2014 BR: revisited Script 23 | 13.08.2014 MS: remove $logfile = Set-logFile, it would be used in the 10_XX_LIB_Config.ps1 Script only 24 | 17.08.2014 MS: change line 32 to $SEP_path = "$ProgramFilesx86\Symantec\Symantec Endpoint Protection" 25 | 31.08.2015 MS: bugfix 89 - symantec fixes the registry location for the SEP-Client to WOW6432Node, fix in line 31-32 and function SetHostID 26 | 01.09.2015 MS: Bugfix 89 sucessfull tested 27 | 06.10.2015 MS: rewritten script with standard .SYNOPSIS, central BISF function couldn't used for services, SEP Service must being started with smc.exe 28 | 09.01.2017 MS: change code to get MacAdress to use function Get-BISMACAddress 29 | 01.07.2018 MS: Hotfix 49: After SEP is started with smc.exe, sometimes the service will not be started. Controlled and logged now with Test-BISFServiceState in Line 58 30 | 18.02.2020 JK: Fixed Log output spelling 31 | 19.02.2020 MS: HF 212 - SEP duplicate HardwareID - Get-BISFMacaddress returns lower- instead of uppercase MACAddress -> compare HardwareID after ServiceStart 32 | 33 | 34 | .LINK 35 | https://eucweb.com 36 | #> 37 | 38 | Begin { 39 | $reg_SEP_string = "Symantec\Symantec Endpoint Protection\SMC\SYLINK\SyLink" 40 | $Product = "Symantec Enterprise Protection" 41 | $ServiceName = "SepMasterService" 42 | $HKLM_reg_SEP_string = "$HKLM_sw_x86\$reg_SEP_string" 43 | $SEP_path = "$ProgramFilesx86\Symantec\Symantec Endpoint Protection" 44 | $reg2Check = "SerialNumber" 45 | $reg_SEP_name = "HardwareID" 46 | $HostID_Prfx = "00000000000000000000" 47 | $PSScriptFullName = $MyInvocation.MyCommand.Path 48 | $PSScriptRoot = Split-Path -Parent $PSScriptFullName 49 | $PSScriptName = [System.IO.Path]::GetFileName($PSScriptFullName) 50 | } 51 | 52 | Process { 53 | 54 | ## Start SEP Service 55 | function StartSEP { 56 | Write-BISFLog -Msg "Start Service $($ServiceName.DisplayName)" 57 | & $ProgramFilesx86'\Symantec\Symantec Endpoint Protection\smc.exe' "-start" 58 | Test-BISFServiceState -ServiceName $ServiceName -Status "Running" 59 | $testHardwareID = Get-ItemPropertyValue -Path $HKLM_reg_SEP_string -Name $reg_SEP_name 60 | IF ($testHardwareID -eq $regHostID) { 61 | Write-BISFLog -Msg "HardwareID in registry is set correctly: $testHardwareID" 62 | } ELSE { 63 | Write-BISFLog -Msg "After the AV-Service is started, HardwareID in registry is NOT set correcty: Registry HardwareID $testHardwareID <-> Defined HardwareID $regHostID" -Type W -SubMsg 64 | } 65 | } 66 | 67 | 68 | ## set HostID in Registry 69 | function SetHostID { 70 | # 31.08.2015 MS: check if Sep Registry Key exists in registry location 71 | $TestSEPinReg = Test-BISFRegistryValue -Path $HKLM_reg_SEP_string -Value $reg2Check 72 | IF ($TestSEPinReg -eq $false) { 73 | $HKLM_reg_SEP_string = "$hklm_software\$reg_SEP_string" 74 | $TestSEPinReg = Test-BISFRegistryValue -Path $HKLM_reg_SEP_string -Value $reg2Check 75 | } 76 | 77 | IF ($TestSEPinReg -eq $true) { 78 | Write-BISFLog -Msg "Registry Location for specified SEP Keys will be set to $HKLM_reg_SEP_string" 79 | 80 | $mac = Get-BISFMACAddress 81 | Write-BISFLog -Msg "$reg_SEP_name Prefix: $HostID_Prfx" 82 | $global:regHostID = $HostID_Prfx + $mac 83 | Write-BISFLog -Msg "$reg_SEP_name will be defined as: $regHostID" 84 | Write-BISFLog -Msg "set $reg_SEP_name in Registry $HKLM_reg_SEP_string" 85 | Set-ItemProperty -Path $HKLM_reg_SEP_string -Name $reg_SEP_name -value $regHostID -ErrorAction SilentlyContinue 86 | 87 | } 88 | ELSE { 89 | Write-BISFLog -Msg "Registry Location for specified SEP Keys could not be set to $HKLM_reg_SEP_string" -Type W -SubMsg 90 | Write-BISFLog -Msg " The Value $reg2Check does not exist in the above location!" -Type W -SubMsg 91 | Write-BISFLog -Msg "The SEP Service will be started, but each boot will create ghost entries in the SEP Management Server" -Type W -SubMsg 92 | } 93 | } 94 | #################################################################### 95 | 96 | #### Main Program 97 | IF (Test-Path ("$SEP_path\smc.exe") -PathType Leaf) { 98 | Write-BISFLog -Msg "Symantec Endpoint Protection installed" -ShowConsole -Color Cyan 99 | SetHostID 100 | StartSEP 101 | } 102 | ELSE { 103 | Write-BISFLog -Msg "Symantec Endpoint Protection NOT installed" 104 | } 105 | 106 | } 107 | 108 | 109 | End { 110 | Add-BISFFinishLine 111 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_SCCM.ps1: -------------------------------------------------------------------------------- 1 | #requires -version 3 2 | <# 3 | .SYNOPSIS 4 | Prepare SCCM Client for Image Managemement 5 | .DESCRIPTION 6 | Delete computer specific entries 7 | .EXAMPLE 8 | ./10_PrepBISF_SCCM.ps1 9 | .NOTES 10 | Author: Matthias Schlimm 11 | Company: EUCWeb.com 12 | 13 | History: 14 | 26.03.2014 MS: Script created for SCCM 2012 R2 15 | 01.04.2014 MS: Change Console message 16 | 02.05.2014 MS: BUG code-error certstore SMS not deleted > & Invoke-Expression 'certutil -delstore SMS "SMS"' 17 | 11.08.2014 MS: Remove Write-Host change to Write-BISFLog 18 | 13.08.2014 MS: Remove $logfile = Set-logFile, it would be used in the 10_XX_LIB_Config.ps1 Script only 19 | 19.02.2015 MS: Syntax error and error handling 20 | 06.03.2015 MS: Delete CCM Package Cache 21 | 05.05.2015 MS: #temp. deactivate Remove-CCMCache , some errors more testing 22 | 01.09.2015 MS: Bugfix 42 - fixing deleteCCMCahce, this must be running before service stops 23 | 30.09.2015 MS: Rewritten script with standard .SYNOPSIS, use central BISF function to configure service 24 | 10.05.2019 JP: Added command to remove hardware inventory as recommended by Citrix https://support.citrix.com/article/CTX238513 25 | 10.05.2019 JP: Converted wmic commands to Get-CimInstance and reworked script synthax 26 | 14.05.2019 JP: The CcmExec service is no longuer set to manual 27 | 08.12.2019:JP: Fixed error on line 74, thanks toBrian Timp 28 | 20.12.2019 MS/SF: HF 153 (PR) - SCCM Agent preparation - fix Test-BISFService - parameter cannot be found 29 | 21.11.2020 MS: HF 289 - terminate ccmexec process before stopping the service 30 | 09.12.2020 MS: HF 296 - additional sealing steps are required 31 | 32 | .LINK 33 | https://eucweb.com 34 | #> 35 | 36 | Begin { 37 | $PSScriptFullName = $MyInvocation.MyCommand.Path 38 | $PSScriptRoot = Split-Path -Parent $PSScriptFullName 39 | $PSScriptName = [System.IO.Path]::GetFileName($PSScriptFullName) 40 | [string]$appVendor = 'Microsoft' 41 | [string]$appName = "SCCM Agent" 42 | [string]$appInstallPath = "$env:windir\CCM" 43 | [string]$appService = 'CcmExec' 44 | [string]$appRegKey = "$hklm_software\Microsoft\SystemCertificates\SMS\Certificates" 45 | $CryptoPath = "C:\ProgramData\Microsoft\Crypto" 46 | $CryptoKey = "Keys" 47 | $OldCrpytoKey = "KeysOLD" 48 | $CryptoKeyPath = $CryptoPath + "\" + $CryptoKey 49 | $OldCrpytoKeyPath = $CryptoPath + "\" + $OldCrpytoKey 50 | } 51 | 52 | Process { 53 | 54 | function Remove-CCMData { 55 | Write-BISFLog -Msg "$appVendor $appName SMSCFG.ini was deleted" 56 | Remove-Item -Path "$env:windir\SMSCFG.ini" -Force -ErrorAction SilentlyContinue 57 | 58 | Write-BISFLog -Msg "$appVendor $appName certificates from SMS store were removed" 59 | Remove-Item -Path $appRegKey\* -Force 60 | 61 | Write-BISFLog -Msg "$appVendor $appName site key information was reset" 62 | Get-CimInstance -Namespace root\ccm\locationservices -Class TrustedRootKey | Remove-CimInstance 63 | 64 | Write-BISFLog -Msg "$appVendor $appName hardware inventory was deleted" 65 | Get-CimInstance -Namespace root\ccm\invagt -Class InventoryActionStatus | Where-Object { $_.InventoryActionID -eq "{00000000-0000-0000-0000-000000000001}" } | Remove-CimInstance 66 | 67 | Write-BISFLog -Msg "$appVendor $appName scheduler history deleted" 68 | Get-CimInstance -Namespace root\ccm\scheduler -Class CCM_Scheduler_History | Where-Object { $_.ScheduleID -eq "{00000000-0000-0000-0000-000000000001}" } | Remove-CimInstance 69 | 70 | $DSRegValue = Get-BISFDSRegState -Key "AzureADjoined" 71 | IF ($DSRegValue -eq "YES") { 72 | Write-BISFLog -Msg "Leaving AAD" 73 | Start-BISFProcWithProgBar -ProcPath "$env:windir\system32\dsregcmd.exe" -Args "/leave" -ActText "leaving AAD" 74 | Start-BISFProcWithProgBar -ProcPath "$env:windir\system32\dsregcmd.exe" -Args "/status" -ActText "Displays the device join status" 75 | } 76 | 77 | Write-BISFLog -Msg "Rename Folder $CryptoKeyPath to $OldCrpytoKey" 78 | Rename-Item -Path $CryptoKeyPath -NewName $OldCrpytoKey -Force 79 | 80 | Write-BISFLog -Msg "Create folder Rename $CryptoKeyPath" 81 | New-Item -Path $CryptoKeyPath -ItemType Directory 82 | 83 | Write-BISFLog -Msg "Set ACL to $CryptoKeyPath" 84 | Get-Acl -Path $OldCrpytoKeyPath | Set-Acl -Path $CryptoKeyPath 85 | 86 | } 87 | 88 | # Original source http://www.david-obrien.net/2013/02/how-to-configure-the-configmgr-client 89 | function Remove-CCMCache { 90 | [CmdletBinding()] 91 | $UIResourceMgr = New-Object -ComObject UIResource.UIResourceMgr 92 | $Cache = $UIResourceMgr.GetCacheInfo() 93 | $CacheElements = $Cache.GetCacheElements() 94 | foreach ($Element in $CacheElements) { 95 | Write-BISFLog -Msg "$appVendor $appName deleted Cache Element with PackageID $($Element.ContentID)" 96 | Write-BISFLog -Msg "from folder $($Element.Location)" 97 | $Cache.DeleteCacheElement($Element.CacheElementID) 98 | } 99 | } 100 | 101 | $svc = Test-BISFService -ServiceName $appService 102 | IF ($svc -eq $true) { 103 | Remove-CCMCache # 01.09.2015 MS: Remove-CCMCache must be run before stopping the service 104 | Stop-BISFProcesses -processName $appService 105 | Invoke-BISFService -ServiceName $appService -Action Stop 106 | Remove-CCMData 107 | } 108 | } 109 | 110 | End { 111 | Add-BISFFinishLine 112 | } 113 | -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_SetPageFile.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Sets the page file to a defined location 4 | .DESCRIPTION 5 | Sets the page file to a defined location. Tested on 2016, 2012R2, 2008R2 6 | .EXAMPLE 7 | .NOTES 8 | Author: Trentent Tye 9 | Company: TheoryPC 10 | 11 | History: 12 | 2017.06.27 TT: Script created 13 | 2017.08.05 TT: Tested on 2008 R2 14 | 2018.01.29 TT: Fixed error appearing even though no such error existed. 15 | 2019.10.11 MS: IF ADMX is not configured or disabled skip any pagefile configuration 16 | 17.02.2020 MS: HF 207 - PageFiel not set 17 | 18.02.2020 JK: Fixed Log output spelling 18 | 19 | .LINK 20 | https://eucweb.com 21 | #> 22 | 23 | Begin { 24 | $script_path = $MyInvocation.MyCommand.Path 25 | $script_dir = Split-Path -Parent $script_path 26 | $script_name = [System.IO.Path]::GetFileName($script_path) 27 | $pageFileInitialSize = ([int]$LIC_BISF_CLI_PAGEFILE_SIZE * 1024) 28 | $pageFileMaximumSize = ([int]$LIC_BISF_CLI_PAGEFILE_SIZE * 1024) 29 | if ($LIC_BISF_CLI_PAGEFILE_DRIVE -eq "$PVSWriteCacheDrive") { 30 | $pagefileLocation = "$LIC_BISF_CLI_WCD\pagefile.sys" 31 | } 32 | else { 33 | $pageFileLocation = "$LIC_BISF_CLI_PAGEFILE_DRIVE\pagefile.sys" 34 | } 35 | $recreatePageFile = $false 36 | } 37 | 38 | Process { 39 | IF ($LIC_BISF_POL_PAGEFILE -eq 1) { 40 | Write-BISFLog -Msg "Checking PageFile settings" -ShowConsole -Color Cyan 41 | Write-BISFLog -Msg "Variable LIC_BISF_CLI_PAGEFILE_SIZE : $LIC_BISF_CLI_PAGEFILE_SIZE" -ShowConsole -Color Cyan -SubMsg 42 | Write-BISFLog -Msg "Variable LIC_BISF_CLI_PAGEFILE_DRIVE : $LIC_BISF_CLI_PAGEFILE_DRIVE" -ShowConsole -Color Cyan -SubMsg 43 | Write-BISFLog -Msg "Variable LIC_BISF_CLI_WCD : $LIC_BISF_CLI_WCD" -ShowConsole -Color Cyan -SubMsg 44 | Write-BISFLog -Msg "Variable pageFileLocation : $pageFileLocation" -ShowConsole -Color Cyan -SubMsg 45 | Write-BISFLog -Msg "Variable pageFileInitialSize : $pageFileInitialSize" -ShowConsole -Color Cyan -SubMsg 46 | Write-BISFLog -Msg "Variable pageFileMaximumSize : $pageFileMaximumSize" -ShowConsole -Color Cyan -SubMsg 47 | 48 | $CurrentPageFile = Get-WmiObject -query "select * from Win32_PageFileSetting" 49 | $System = Get-WmiObject Win32_ComputerSystem -EnableAllPrivileges 50 | 51 | #we set our pagefile to D:\pagefile.sys with initial and maximum values at 4096MB and disable automatic pagefile management 52 | if ($System.AutomaticManagedPagefile -eq $true) { 53 | #system management pagefile found. 54 | Write-BISFLog -Msg "System Managed Pagefile found. Removing..." -ShowConsole -Color DarkCyan -SubMsg 55 | $System.AutomaticManagedPagefile = $false 56 | $errorHandling = $ErrorActionPreference 57 | $errorActionPreference = "SilentlyContinue" 58 | #$System.put() generates an error even though it succeeds. We'll mask the error by changing error action temporairily. 59 | $System.Put() 60 | $errorActionPreference = $errorHandling 61 | } 62 | if (($CurrentPageFile.SettingID).count -ne 1) { 63 | #is there more than 1 pagefile set (eg, pagefiles are set on multiple drives?) 64 | $recreatePageFile = $true 65 | } 66 | if ($CurrentPageFile.initialSize -ne $pageFileInitialSize) { 67 | Write-BISFLog -Msg "Configuring Pagefile Initial Size to $pageFileInitialSize" -ShowConsole -Color DarkCyan -SubMsg 68 | $recreatePageFile = $true 69 | } 70 | if ($CurrentPageFile.MaximumSize -ne $pageFileMaximumSize) { 71 | Write-BISFLog -Msg "Configuring Pagefile Maximum Size to $pageFileMaximumSize" -ShowConsole -Color DarkCyan -SubMsg 72 | $recreatePageFile = $true 73 | } 74 | if (-not($CurrentPageFile.name -like $pageFileLocation)) { 75 | #pageFile location not set to D:\pagefile.sys 76 | Write-BISFLog -Msg "Configuring Pagefile location to $pageFileLocation" -ShowConsole -Color DarkCyan -SubMsg 77 | $recreatePageFile = $true 78 | } 79 | 80 | if ($recreatePageFile -eq $true) { 81 | $CurrentPageFile = Get-WmiObject -Query "select * from Win32_PageFileSetting" 82 | if ($CurrentPageFile -ne $null) { $CurrentPageFile.Delete() } 83 | 84 | Set-WMIInstance -class Win32_PageFileSetting -Arguments @{name=$pageFileLocation;InitialSize = $pageFileInitialSize;MaximumSize = $pageFileMaximumSize} | out-null 85 | Write-BISFLog -Msg "New Pagefile settings applied:" -ShowConsole -Color DarkCyan -SubMsg 86 | $CurrentPageFile = Get-WmiObject -Query "select * from Win32_PageFileSetting" 87 | Write-BISFLog -Msg "Number of pagefiles: $($($CurrentPageFile.SettingID).count)" -ShowConsole -Color DarkCyan -SubMsg 88 | Write-BISFLog -Msg "Pagefile location: $($CurrentPageFile.name)" -ShowConsole -Color DarkCyan -SubMsg 89 | Write-BISFLog -Msg "Pagefile initial size: $($CurrentPageFile.initialSize)" -ShowConsole -Color DarkCyan -SubMsg 90 | Write-BISFLog -Msg "Pagefile maximum size: $($CurrentPageFile.MaximumSize)" -ShowConsole -Color DarkCyan -SubMsg 91 | Set-BISFPreparationState -RebootRequired #ensure we reboot to enforce values 92 | } 93 | if ($recreatePageFile -eq $false) { 94 | Write-BISFLog -Msg "Pagefile set to correct values" -ShowConsole -Color DarkCyan -SubMsg 95 | } 96 | } ELSE { 97 | Write-BISFLog -Msg "Pagefile is NOT configured" 98 | } 99 | } 100 | 101 | 102 | End { 103 | Add-BISFFinishLine 104 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/80_PrepBISF_WriteCacheDisk.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding(SupportsShouldProcess = $true)] 2 | param( 3 | ) 4 | <# 5 | .SYNOPSIS 6 | Prepare PVSWriteCacheDisk 7 | .DESCRIPTION 8 | .EXAMPLE 9 | .NOTES 10 | Author: Matthias Schlimm 11 | Editor: Mike Bijl (Rewritten variable names and script format) 12 | Company: EUCWeb.com 13 | 14 | History: 15 | 28.02.2013 MS: Script created 16 | 07.03.2013 MS: Read from diskpart, error to read substring, write empty uniqueID to registry 17 | 25.06.2013 MS: Change location for temporary Diskpartfile to %TEMP% 18 | 12.09.2013 MS: Critical fix to get uniqueid on english display language only 19 | 18.09.2013 MS: replace $date with $(Get-date) to get current timestamp at running scriptlines write to the logfile 20 | 01.10.2013 MS: add function SetRefSrv - Set Reference Server Hostname in registry to detect it in the personalize script to skip reboot 21 | 03.03.2014 BR: Revisited Script 22 | 18.03.2014 BR: revisited Script 23 | 21.03.2014 MS: add setCDROM, last code change before release to web 24 | 13.08.2014 MS: remove $logfile = Set-logFile, it would be used in the 10_XX_LIB_Config.ps1 Script only 25 | 13.08.2014 MS: Check if $returnCheckPVSSysVariable exists, then get uniqueID from persitend drive and set it to registry 26 | 20.08.2014 MS: add line 70 -> get-LogContent -GetLogFile "$DiskpartFile" 27 | 31.10.2014 MB: renamed variable: returnCheckPVSSysVariable -> returnTestPVSEnvVariable 28 | 01.10.2015 MS: rewritten script to use central BISF function 29 | 10.01.2017 MS: BugFix 134- PrepareWriteCacheDisk: add space on either side of the Driveletter variable $searvol, thx to Jeremy Saunders 30 | 10.01.2017 MS: BugFix 134: PrepareWriteCacheDisk: MBR disk with 8 characters to get the right uniqueID from Diskpart only, PVS does not support GPT disk, see https://support.citrix.com/article/CTX139478 thx to Jeremy Saunders 31 | 04.03.2017 MS: BugFix: DiskID is not language neutral, split string after ":" to read the right side only 32 | 29.07.2017 MS: Feature Request 192: support GPT WriteCacheDisk 33 | 25.08.2019 MS: ENH 128 - Disable any command if WriteCacheDisk is set to NONE 34 | 05.10.2019 MS: HF 69 - If WriteCache disk on master is GPT-partiton then uniqueid doesn't match 35 | 18.02.2020 JK: Fixed Log output spelling 36 | 18.01.2021 MS: using PoSh standard verbs for functions 37 | 38 | .LINK 39 | https://eucweb.com 40 | #> 41 | 42 | Begin { 43 | 44 | #################################################################### 45 | # define environment 46 | # Setting default variables ($PSScriptroot/$logfile/$PSCommand,$PSScriptFullname/$scriptlibrary/LogFileName) independent on running script from console or ISE and the powershell version. 47 | If ($($host.name) -like "* ISE *") { 48 | # Running script from Windows Powershell ISE 49 | $PSScriptFullName = $psise.CurrentFile.FullPath.ToLower() 50 | $PSCommand = (Get-PSCallStack).InvocationInfo.MyCommand.Definition 51 | } 52 | ELSE { 53 | $PSScriptFullName = $MyInvocation.MyCommand.Definition.ToLower() 54 | $PSCommand = $MyInvocation.Line 55 | } 56 | [string]$PSScriptName = (Split-Path $PSScriptFullName -leaf).ToLower() 57 | If (($PSScriptRoot -eq "") -or ($PSScriptRoot -eq $null)) { [string]$PSScriptRoot = (Split-Path $PSScriptFullName).ToLower() } 58 | 59 | $SysDrive = $env:systemdrive 60 | $reg_value_UniqueID = "LIC_BISF_UniqueID_Disk" 61 | $reg_value_RefSrv_Hostname = "LIC_BISF_RefSrv_Hostname" 62 | $PVSDiskLabel = "PVSWriteCacheDisk" 63 | $DiskpartFile = "C:\Windows\Temp\$computer-DiskpartFile.txt" 64 | 65 | #################################################################### 66 | ####### functions ##### 67 | #################################################################### 68 | function Get-UniqueDiskID { 69 | <# 70 | .SYNOPSIS 71 | GetUniqueID 72 | 73 | .DESCRIPTION 74 | Write the UnqiueID of the CacheDisk to the registry 75 | to use it later on the cloned devices 76 | 77 | 78 | .NOTES 79 | Author: Matthias Schlimm 80 | 81 | Company: EUCWeb.com 82 | 83 | History: 84 | dd.mm.yyyy MS: Script created 85 | 18.01.2021 MS: HF 302 using function Get-BISFDiskID instead of the same code here 86 | 87 | #> 88 | Get-BISFDiskID -Driveletter $PVSDiskDrive 89 | Write-BISFLog -Msg "Set uniqueID $getid for volume $VolNbr / Driveletter $PVSDiskDrive to Registry $hklm_software_LIC_CTX_BISF_SCRIPTS" 90 | Set-ItemProperty -Path $hklm_software_LIC_CTX_BISF_SCRIPTS -Name $reg_value_UniqueID -value $DiskID -ErrorAction SilentlyContinue 91 | } 92 | 93 | function Set-ReferenceServer { 94 | # Set Reference Server Hostname in registry to detect it in the personalize script to skip reboot 95 | Write-BISFLog -Msg "Write Reference Server Hostname $computer to Registry $hklm_software_LIC_CTX_BISF_SCRIPTS" 96 | Set-ItemProperty -Path $hklm_software_LIC_CTX_BISF_SCRIPTS -Name $reg_value_RefSrv_Hostname -value $computer -ErrorAction SilentlyContinue 97 | } 98 | 99 | function Set-OpticalDrive { 100 | $CDrom = Get-CimInstance -ClassName Win32_Volume -Filter "DriveType = 5" 101 | $CDromDriveletter = $CDrom.Driveletter 102 | Set-ItemProperty -Path $hklm_software_LIC_CTX_BISF_SCRIPTS -Name "LIC_BISF_OptDrive" -Value $CDromDriveletter 103 | Write-BISFLog -Msg "set optical driveletter $CDromDriveletter" 104 | } 105 | 106 | #################################################################### 107 | ####### end functions ##### 108 | #################################################################### 109 | } 110 | Process { 111 | 112 | #### Main Program 113 | IF (!($LIC_BISF_CLI_WCD -eq "NONE")) { 114 | IF ($returnTestPVSEnvVariable -eq $true) { 115 | Get-UniqueDiskID 116 | } 117 | ELSE { 118 | Write-BISFLog -Msg "CacheDisk environment variable not defined, skipping configuration" 119 | } 120 | } 121 | ELSE { 122 | Write-BISFLog -Msg "CacheDisk is set to 'NONE', skipping configuration" 123 | } 124 | Set-OpticalDrive 125 | Set-ReferenceServer 126 | } 127 | END { 128 | Add-BISFFinishLine 129 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/51_PrepBISF_DeleteRDSGracePeriod.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Delete RDS Grace Period Registry Key 4 | .DESCRIPTION 5 | Delete RDS Timebomb Key for never ending grace Period 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | Company: EUCWeb.com 10 | 11 | History: 12 | 14.04.2016 BR: Script created 13 | 17.06.2016 BR: Added Filter for Operating System Type 14 | 31.07.2020 MS: HF 268 - Using SID to translate it to the real name to support MUI Systems 15 | 16 | .LINK 17 | https://eucweb.com 18 | #> 19 | 20 | Begin { 21 | $RootBISFFolder = Split-Path (Split-Path $LIC_BISF_MAIN_PersScript) 22 | $Product = $FrameworkName 23 | $script_path = $MyInvocation.MyCommand.Path 24 | $script_dir = Split-Path -Parent $script_path 25 | $script_name = [System.IO.Path]::GetFileName($script_path) 26 | 27 | function enable-privilege { 28 | param( 29 | ## The privilege to adjust. This set is taken from 30 | ## http://msdn.microsoft.com/en-us/library/bb530716(VS.85).aspx 31 | [ValidateSet( 32 | "SeAssignPrimaryTokenPrivilege", "SeAuditPrivilege", "SeBackupPrivilege", 33 | "SeChangeNotifyPrivilege", "SeCreateGlobalPrivilege", "SeCreatePagefilePrivilege", 34 | "SeCreatePermanentPrivilege", "SeCreateSymbolicLinkPrivilege", "SeCreateTokenPrivilege", 35 | "SeDebugPrivilege", "SeEnableDelegationPrivilege", "SeImpersonatePrivilege", "SeIncreaseBasePriorityPrivilege", 36 | "SeIncreaseQuotaPrivilege", "SeIncreaseWorkingSetPrivilege", "SeLoadDriverPrivilege", 37 | "SeLockMemoryPrivilege", "SeMachineAccountPrivilege", "SeManageVolumePrivilege", 38 | "SeProfileSingleProcessPrivilege", "SeRelabelPrivilege", "SeRemoteShutdownPrivilege", 39 | "SeRestorePrivilege", "SeSecurityPrivilege", "SeShutdownPrivilege", "SeSyncAgentPrivilege", 40 | "SeSystemEnvironmentPrivilege", "SeSystemProfilePrivilege", "SeSystemtimePrivilege", 41 | "SeTakeOwnershipPrivilege", "SeTcbPrivilege", "SeTimeZonePrivilege", "SeTrustedCredManAccessPrivilege", 42 | "SeUndockPrivilege", "SeUnsolicitedInputPrivilege")] 43 | $Privilege, 44 | ## The process on which to adjust the privilege. Defaults to the current process. 45 | $ProcessId = $pid, 46 | ## Switch to disable the privilege, rather than enable it. 47 | [Switch] $Disable 48 | ) 49 | 50 | ## Taken from P/Invoke.NET with minor adjustments. 51 | $definition = @' 52 | using System; 53 | using System.Runtime.InteropServices; 54 | 55 | public class AdjPriv 56 | { 57 | [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] 58 | internal static extern bool AdjustTokenPrivileges(IntPtr htok, bool disall, 59 | ref TokPriv1Luid newst, int len, IntPtr prev, IntPtr relen); 60 | 61 | [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] 62 | internal static extern bool OpenProcessToken(IntPtr h, int acc, ref IntPtr phtok); 63 | [DllImport("advapi32.dll", SetLastError = true)] 64 | internal static extern bool LookupPrivilegeValue(string host, string name, ref long pluid); 65 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 66 | internal struct TokPriv1Luid 67 | { 68 | public int Count; 69 | public long Luid; 70 | public int Attr; 71 | } 72 | 73 | internal const int SE_PRIVILEGE_ENABLED = 0x00000002; 74 | internal const int SE_PRIVILEGE_DISABLED = 0x00000000; 75 | internal const int TOKEN_QUERY = 0x00000008; 76 | internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; 77 | public static bool EnablePrivilege(long processHandle, string privilege, bool disable) 78 | { 79 | bool retVal; 80 | TokPriv1Luid tp; 81 | IntPtr hproc = new IntPtr(processHandle); 82 | IntPtr htok = IntPtr.Zero; 83 | retVal = OpenProcessToken(hproc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref htok); 84 | tp.Count = 1; 85 | tp.Luid = 0; 86 | if(disable) 87 | { 88 | tp.Attr = SE_PRIVILEGE_DISABLED; 89 | } 90 | else 91 | { 92 | tp.Attr = SE_PRIVILEGE_ENABLED; 93 | } 94 | retVal = LookupPrivilegeValue(null, privilege, ref tp.Luid); 95 | retVal = AdjustTokenPrivileges(htok, false, ref tp, 0, IntPtr.Zero, IntPtr.Zero); 96 | return retVal; 97 | } 98 | } 99 | '@ 100 | 101 | $processHandle = (Get-Process -id $ProcessId).Handle 102 | $type = Add-Type $definition -PassThru 103 | $type[0]::EnablePrivilege($processHandle, $Privilege, $Disable) 104 | } 105 | } 106 | 107 | Process { 108 | 109 | if ((Get-CimInstance -ClassName Win32_OperatingSystem).ProductType -eq "3") { 110 | #Adjust current uSer privilegs 111 | enable-privilege SeTakeOwnershipPrivilege 112 | 113 | #Take Ownership of Registry Key 114 | $key = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod", [Microsoft.Win32.RegistryKeyPermissionCheck]::ReadWriteSubTree, [System.Security.AccessControl.RegistryRights]::takeownership) 115 | $acl = $key.GetAccessControl([System.Security.AccessControl.AccessControlSections]::None) 116 | $SID = "S-1-5-32-544" #Builtin\Admnistrators 117 | $objSID = New-Object System.Security.Principal.SecurityIdentifier($SID) 118 | $objUser = $objSID.Translate([System.Security.Principal.NTAccount]) 119 | $localname = $objUser.Value 120 | $me = [System.Security.Principal.NTAccount]$localname 121 | $acl.SetOwner($me) 122 | $key.SetAccessControl($acl) 123 | 124 | #Read current ACL and add rule for Builtin\Admnistrators 125 | $acl = $key.GetAccessControl() 126 | $rule = New-Object System.Security.AccessControl.RegistryAccessRule ($localname, "FullControl", "Allow") 127 | $acl.SetAccessRule($rule) 128 | $key.SetAccessControl($acl) 129 | $key.Close() 130 | 131 | #Search Timebomb Key and delete it 132 | $items = $null 133 | $item = $null 134 | 135 | $Items = Get-Item "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod" 136 | foreach ($item in $Items) { 137 | if ($item.Property -like "*TIMEBOMB*") { 138 | Write-BISFLog -Msg "Deleting $($item.Property)" 139 | Remove-ItemProperty -path $Item.PSPath -Name $item.Property #-WhatIf 140 | } 141 | } 142 | } 143 | } 144 | 145 | End { 146 | Add-BISFFinishLine 147 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_AppVClient.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare Microsoft AppV for Image Managemement 4 | .DESCRIPTION 5 | Reconfigure the Microsoft AppV 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | 10 | History: 11 | 21.08,2015 MS: function created 12 | 30.09.2015 MS: rewritten script with standard .SYNOPSIS, use central BISF function to configure service 13 | 03.03.2016 MS: Issue 113 - AppVClient Cache did not resolve to correct service status, thx to @valentinop 14 | 10.01.2017 MS: add CLI command or MessageBox to delete PreCached App-V Packages 15 | 24.11.2017 MS: add SubMSg do Write-BISFLog -Msg "The App-V PackageInstallationRoot $PckInstRoot Folder not exist, nothing to clean up." -Type W -SubMsg 16 | 14.08.2019 MS: FRQ 3 - Remove Messagebox and using default setting if GPO is not configured 17 | 18.02.2020 JK: Fixed Log output spelling 18 | 20.02.2020 MS: HF 210 - App-V PackageInstallationRoot not detected properly 19 | 23.05.2020 MS: HF 226 - App-V Powershell Module Could Not Be Loaded 20 | 21 | 22 | .LINK 23 | https://eucweb.com 24 | #> 25 | 26 | Begin { 27 | $script_path = $MyInvocation.MyCommand.Path 28 | $script_dir = Split-Path -Parent $script_path 29 | $script_name = [System.IO.Path]::GetFileName($script_path) 30 | $Product = "Microsoft App-V Client" 31 | $servicename = "AppVClient" 32 | } 33 | 34 | Process { 35 | 36 | function PrepareAgent { 37 | $AppvsvcStatus = Get-Service -Name $servicename 38 | If ($AppvsvcStatus.Status -ne "Running") { 39 | Write-BISFLog "The client service is not running. The Script cannot clean up package files." -Type W -SubMsg 40 | } 41 | ELSE { 42 | $HKLM_Path = "HKLM:\Software\Microsoft\AppV\Client" 43 | $Installpath = (Get-ItemProperty -path $HKLM_Path).InstallPath 44 | $ModuleFile = "AppvClient.psd1" 45 | $AppVPath = (Get-ChildItem -Path $Installpath -Recurse -Filter $ModuleFile -ErrorAction SilentlyContinue).Directory.FullName 46 | $ModulePath = "$AppVPath\$ModuleFile" 47 | Write-BISFLog -Msg "AppV Module is located in path $AppVPath" 48 | $PckInstRoot = (get-appvclientconfiguration -name PackageInstallationRoot).value 49 | $PckInstRoot = [Environment]::ExpandEnvironmentVariables($PckInstRoot) 50 | if (!$PckInstRoot) { 51 | Write-BISFLog -Msg "PackageInstallationRoot is required for removing packages" -Type E -SubMsg 52 | } 53 | IF (Test-Path $PckInstRoot) { 54 | 55 | Write-BISFLog -Msg "Check GPO Configuration" -SubMsg -Color DarkCyan 56 | $varCLI = Get-Variable -Name LIC_BISF_CLI_AR -ValueOnly 57 | IF (($varCLI -eq "YES") -or ($varCLI -eq "NO")) { 58 | Write-BISFLog -Msg "GPO Valuedata: $varCLI" 59 | } 60 | ELSE { 61 | Write-BISFLog -Msg "GPO not configured.. using default setting"" 62 | $AppVRemoval = "NO 63 | } 64 | if (($AppVRemoval -eq "YES" ) -or ($varCLI -eq "YES")) { 65 | $packageFiles = Get-ChildItem ([System.Environment]::ExpandEnvironmentVariables($PckInstRoot)); 66 | if (!$packageFiles -or $packageFiles.Count -eq 0) { 67 | Write-BISFLog -Msg "No package files found, nothing to clean up." -Type W -SubMsg 68 | } 69 | ELSE { 70 | Write-BISFLog -Msg "Removing App-V packages" -ShowConsole -Color DarkGreen -SubMsg 71 | $error.clear(); 72 | # load the client 73 | Import-Module $ModulePath; 74 | # shutdown all active Connection Groups 75 | Write-BISFLog -Msg "Stopping all connection groups."; 76 | Get-AppvClientConnectionGroup -all | Stop-AppvClientConnectionGroup -Global; 77 | 78 | # shutdown all active Connection Groups 79 | Write-BISFLog -Msg "Stopping all connection groups."; 80 | Get-AppvClientConnectionGroup -all | Stop-AppvClientConnectionGroup -Global; 81 | 82 | # poll while there are still active connection groups 83 | $connectionGroups = Get-AppvClientConnectionGroup -all 84 | $connectionGroupsInUse = $FALSE; 85 | do { 86 | $connectionGroupsInUse = $FALSE; 87 | ForEach ($connectionGroup in $connectionGroups) { 88 | if ($connectionGroup.InUse -eq $TRUE) { 89 | $connectionGroupsInUse = $TRUE; 90 | Write-BISFLog -Msg "Stopping connection groups" $connectionGroup.Name; 91 | Stop-AppvClientConnectionGroup $connectionGroup -Global; 92 | 93 | # allow 1 second for the VE to tear down before we continue polling 94 | sleep 1; 95 | } 96 | } 97 | } while ($connectionGroupsInUse); 98 | 99 | # shutdown all active Packages 100 | Write-BISFLog -Msg "Stopping all packages"; 101 | Get-AppvClientPackage -all | Stop-AppvClientPackage -Global; 102 | 103 | # poll while there are still active packages 104 | $packages = Get-AppvClientPackage -all; 105 | $packagesInUse = $FALSE; 106 | do { 107 | $packagesInUse = $FALSE; 108 | ForEach ($package in $packages) { 109 | if ($package.InUse -eq $TRUE) { 110 | $packagesInUse = $TRUE; 111 | Write-BISFLog -Msg "Stopping package " $package.Name; 112 | Stop-AppvClientPackage $package -Global; 113 | 114 | # allow 1 second for the VE to tear down before we continue polling 115 | sleep 1; 116 | } 117 | } 118 | } while ($packagesInUse); 119 | 120 | Write-BISFLog -Msg "Removing all App-V Connection Groups"; 121 | ForEach ($connectionGroup in Get-AppvClientConnectionGroup -all) { 122 | Remove-AppvClientConnectionGroup $connectionGroup; 123 | } 124 | 125 | Write-BISFLog -Msg "Removing all App-V Packages"; 126 | ForEach ($package in Get-AppvClientPackage -all) { 127 | Remove-AppvClientPackage $package; 128 | } 129 | } 130 | } 131 | ELSE { 132 | Write-BISFLog -Msg "Skip removing the preCached App-V Packages" 133 | 134 | } 135 | $Error.Clear(); 136 | } 137 | ELSE { 138 | Write-BISFLog -Msg "The App-V PackageInstallationRoot $PckInstRoot Folder does not exist, nothing to clean up." -Type W -SubMsg 139 | } 140 | } 141 | } 142 | 143 | #### Main Program 144 | 145 | $svc = Test-BISFService -ServiceName "$servicename" -ProductName "$product" 146 | IF ($svc -eq $true) { 147 | PrepareAgent 148 | } 149 | } 150 | 151 | 152 | End { 153 | Add-BISFFinishLine 154 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_AV-CylanceProtect.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare Cylance PROTECT Agent for Image Managemement 4 | .DESCRIPTION 5 | Delete computer specific entries 6 | .EXAMPLE 7 | .NOTES 8 | Author: Mathias Kowalkowski 9 | 10 | History 11 | 09.05.2019 MK: Script created 12 | 14.08.2019 MS: ENH 98: add function Set-CompatibilityMode 13 | 02.01.2020 MS: HF 164: Wrong Command for Compatibility Mode 14 | 01.06.2020 MS: HF 238: VDI Fingerprinting support 15 | 01.08.2020 MS: HF 261 - fix Errorhandling 16 | 17 | .LINK 18 | https://eucweb.com 19 | #> 20 | 21 | Begin { 22 | $Script_Path = $MyInvocation.MyCommand.Path 23 | $Script_Dir = Split-Path -Parent $Script_Path 24 | $Script_Name = [System.IO.Path]::GetFileName($Script_Path) 25 | 26 | # Product specific parameters 27 | $ProductName = "Cylance PROTECT" 28 | $ProductPath = "${env:ProgramFiles}\Cylance\Desktop" 29 | $ServiceName = "CylanceSvc" 30 | [array]$ToDelete = @( 31 | [pscustomobject]@{type = "REG"; value = "HKLM:\SOFTWARE\Cylance\Desktop"; data = "FP" }, 32 | [pscustomobject]@{type = "REG"; value = "HKLM:\SOFTWARE\Cylance\Desktop"; data = "FPMask" }, 33 | [pscustomobject]@{type = "REG"; value = "HKLM:\SOFTWARE\Cylance\Desktop"; data = "FPVersion" }, 34 | [pscustomobject]@{type = "REG"; value = "HKLM:\SOFTWARE\Cylance\Desktop"; data = "SelfProtectionLevel" } 35 | ) 36 | } 37 | 38 | Process { 39 | 40 | 41 | #################################################################### 42 | ####### Functions ##### 43 | #################################################################### 44 | 45 | function Remove-Data { 46 | Write-BISFLog -Msg "Delete specified items " 47 | Foreach ($DeleteItem in $ToDelete) { 48 | IF ($DeleteItem.type -eq "REG") { 49 | Write-BISFLog -Msg "Processing registry item to delete" -ShowConsole -SubMsg -color DarkCyan 50 | $VerifyRegistryItem = Test-BISFRegistryValue -Path $DeleteItem.value -Value $DeleteItem.data 51 | IF ($VerifyRegistryItem) { 52 | Write-BISFLog -Msg "Deleting registry item -Path($DeleteItem.value) -Name($DeleteItem.data)" 53 | Remove-ItemProperty -Path $DeleteItem.value -Name $DeleteItem.data -ErrorAction SilentlyContinue 54 | } 55 | } 56 | 57 | IF ($DeleteItem.type -eq "FILE") { 58 | Write-BISFLog -Msg "Processing file item to delete" -ShowConsole -SubMsg -color DarkCyan 59 | $FullFileName = "$DeleteItem.value\$DeleteItem.data" 60 | IF (Test-Path ($FullFileName) -PathType Leaf) { 61 | Write-BISFLog -Msg "Deleting File $FullFileName" 62 | Remove-Item $FullFileName | Out-Null 63 | } 64 | } 65 | } 66 | } 67 | function Stop-Service { 68 | $svc = Test-BISFService -ServiceName "$ServiceName" 69 | IF ($svc -eq $true) { Invoke-BISFService -ServiceName "$($ServiceName)" -Action Stop } 70 | } 71 | 72 | function Set-CompatibilityMode { 73 | <# 74 | .SYNOPSIS 75 | Set Cylance Compatibility Mode 76 | 77 | .DESCRIPTION 78 | As described in https://support.citrix.com/article/CTX232722 79 | you must take ownership of the registry and add a value to enable 80 | compatibility mode 81 | 82 | .NOTES 83 | Author: Matthias Schlimm 84 | 85 | 14.08.2019 MS: function created 86 | 01.08.2020 MS: HF 261 - fix Errorhandling 87 | #> 88 | 89 | $CompatibilityMode = (Get-ItemProperty HKLM:\SOFTWARE\Cylance\Desktop).CompatibilityMode 90 | IF ($CompatibilityMode -ne 0) { 91 | $ErrorActionPreference = "Stop" 92 | Write-BISFLog -Msg "Take Registry Ownership" -ShowConsole -Color DarkCyan -SubMsg 93 | #Adjust current user privilegs 94 | $null = enable-BISFprivilege SeTakeOwnershipPrivilege 95 | 96 | #Take Ownership of Registry Key 97 | $key = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("SOFTWARE\Cylance\Desktop", [Microsoft.Win32.RegistryKeyPermissionCheck]::ReadWriteSubTree, [System.Security.AccessControl.RegistryRights]::takeownership) 98 | try { 99 | $acl = $key.GetAccessControl([System.Security.AccessControl.AccessControlSections]::None) 100 | $me = [System.Security.Principal.NTAccount]"$env:username" 101 | $acl.SetOwner($me) 102 | $key.SetAccessControl($acl) 103 | } 104 | 105 | catch { 106 | Write-BISFLog "ACL Error: $_" -Type W -ShowConsole -SubMsg 107 | } 108 | 109 | 110 | 111 | #Read current ACL and add rule for Builtin\Admnistrators 112 | try { 113 | $acl = $key.GetAccessControl() 114 | $rule = New-Object System.Security.AccessControl.RegistryAccessRule ("$env:username", "FullControl", "Allow") 115 | $acl.SetAccessRule($rule) 116 | $key.SetAccessControl($acl) 117 | $key.Close() 118 | } 119 | 120 | catch { 121 | Write-BISFLog "ACL Error: $_" -Type W -ShowConsole -SubMsg 122 | } 123 | 124 | 125 | Write-BISFLog -Msg "Set Compatibility Mode" -ShowConsole -Color DarkCyan -SubMsg 126 | try { 127 | New-ItemProperty -Path "HKLM:\SOFTWARE\Cylance\Desktop" -Name "CompatibilityMode" -value 01 -PropertyType Binary -Force 128 | } 129 | 130 | catch { 131 | Write-BISFLog "ACL Error: $_" -Type W -ShowConsole -SubMsg 132 | } 133 | $ErrorActionPreference = "Continue" 134 | } ELSE { 135 | Write-BISFLog -Msg "Compatibility Mode is already set to $CompatibilityMode" -ShowConsole -Color DarkCyan -SubMsg 136 | } 137 | } 138 | 139 | #################################################################### 140 | ####### End functions ##### 141 | #################################################################### 142 | 143 | #### Main Program 144 | $svc = Test-BISFService -ServiceName $ServiceName -ProductName $ProductName 145 | If ($svc -eq $true) { 146 | Write-BISFLog -Msg "Product $ProductName installed" -ShowConsole -Color Cyan 147 | $VDIType = (Get-ItemProperty HKLM:\SOFTWARE\Cylance\Desktop).VDIType 148 | IF (!($VDIType -eq 0)) { 149 | Stop-Service 150 | Set-CompatibilityMode 151 | Remove-Data 152 | } Else { 153 | Write-BISFLog -Msg "Skipping ProductName sealing operations !" -ShowConsole -Type W -SubMsg 154 | } 155 | 156 | 157 | } 158 | Else { 159 | Write-BISFLog -Msg "Product $ProductName NOT installed" 160 | } 161 | } 162 | 163 | End { 164 | Add-BISFFinishLine 165 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_AV-TM.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare TrenMicro OfficeScan for Image Managemement 4 | .DESCRIPTION 5 | Delete computer specified entries 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | 10 | History: 11 | 17.09.2014 MS: Script created 12 | 10.08.2015 MS: Kill Tasks of each TM Process before stops the services 13 | 01.10.2015 MS: rewritten script with standard .SYNOPSIS, use central BISF function to configure service 14 | 06.03.2017 MS: Bugfix read Variable $varCLI = ... 15 | 01.08.2017 JS: Updated ini file and delete run value as per https://success.trendmicro.com/solution/1102736 16 | This should be implemented for both RDS and VDI workloads, especially if using published 17 | applications, as it prevents the PccNTMon.exe process from running in user sessions, which 18 | means that the OfficeScan (OSCE) Agent or WFBS-SVC (Worry-Free Business Security Services) 19 | icon is unavailable in the system tray. 20 | Added the TmPfw (OfficeScan NT Firewall) service to the array. 21 | 20.08.2017 JS: I found that the services were not being stopped and set to manual, so added a new TerminateProcess 22 | function and modified the StopService function to make it reliable. 23 | 14.08.2019 MS: FRQ 3 - Remove Messagebox and using default setting if GPO is not configured 24 | 18.02.2020 JK: Fixed Log output spelling 25 | 03.06.2020 MS: HF 233 - TM Process not killed, using new function Stop-BISFProcesses 26 | 05.06.2020 MS: HF 233 - Skipping ApexOne, checkout https://github.com/EUCweb/BIS-F/issues/233 for further informations 27 | 28 | 29 | .LINK 30 | https://eucweb.com 31 | #> 32 | 33 | Begin { 34 | $reg_TM_string = "$HKLM_sw_x86\TrendMicro\PC-cillinNTCorp\CurrentVersion" 35 | [array]$reg_TM_name = "GUID" 36 | $product = "Trend Micro Office Scan" 37 | $product1 = "Trend Micro Apex ONE" 38 | # The main 4 services are: 39 | # - TmListen (OfficeScan NT Listener) 40 | # - NTRTScan (OfficeScan NT RealTime Scan) 41 | # - TmPfw (OfficeScan NT Firewall) 42 | # - TmProxy (OfficeScan NT Proxy Service) 43 | $TMServices = @("TmListen", "NTRTScan", "TmProxy", "TmPfw", "TmCCSF", "TMBMServer") 44 | $TMProcesses = @("TmListen", "NTRTScan", "TmProxy", "TmPfw", "PccNTMon") 45 | $script_path = $MyInvocation.MyCommand.Path 46 | $script_dir = Split-Path -Parent $script_path 47 | $script_name = [System.IO.Path]::GetFileName($script_path) 48 | } 49 | 50 | Process { 51 | 52 | #################################################################### 53 | ####### functions ##### 54 | #################################################################### 55 | 56 | function RunFullScan { 57 | 58 | Write-BISFLog -Msg "Check GPO Configuration" -SubMsg -Color DarkCyan 59 | $varCLI = $LIC_PVS_CLI_AV 60 | IF (($varCLI -eq "YES") -or ($varCLI -eq "NO")) { 61 | Write-BISFLog -Msg "GPO Valuedata: $varCLI" 62 | } 63 | ELSE { 64 | Write-BISFLog -Msg "GPO not configured.. using default setting" -SubMsg -Color DarkCyan 65 | $AVScan = "YES" 66 | } 67 | if (($AVScan -eq "YES" ) -or ($varCLI -eq "YES")) { 68 | Write-BISFLog -Msg "Running Fullscan... please Wait" 69 | #TrendMicro does support SysClen to scan system fromm CLI, but the needed an current patternfile in the same folder as sysclean 70 | } 71 | ELSE { 72 | Write-BISFLog -Msg "No Full Scan will be performed" 73 | } 74 | 75 | } 76 | 77 | function deleteTMData { 78 | foreach ($key in $reg_TM_name) { 79 | Write-BISFLog -Msg "delete specified registry items in $reg_TM_string..." 80 | Write-BISFLog -Msg "delete $key" 81 | Remove-ItemProperty -Path $reg_TM_string -Name $key -ErrorAction SilentlyContinue 82 | } 83 | } 84 | 85 | Function TerminateProcess { 86 | ForEach ($ProcessName in $TMProcesses) { 87 | Stop-BISFProcesses -processName $ProcessName 88 | } 89 | } 90 | 91 | function StopService { 92 | ForEach ($ServiceName in $TMServices) { 93 | $objService = Get-Service $ServiceName -ErrorAction SilentlyContinue 94 | If ($objService) { 95 | Write-BISFLog -Msg "Setting the '$ServiceName' service to manual start" -ShowConsole -SubMsg -Color DarkCyan 96 | #Write-Verbose "Setting the '$ServiceName' service to manual start..." -verbose 97 | #Invoke-BISFService -ServiceName "$($ServiceName)" -Action Stop -StartType manual 98 | # Possible results using the sc.exe command line tool: 99 | # [SC] ChangeServiceConfig2 SUCCESS 100 | # [SC] OpenSCManager FAILED 5: Access is denied. 101 | # [SC] OpenSCManager FAILED 1722: The RPC server is unavailable. 102 | # [SC] OpenService FAILED 1060: The specified service does not exist as an installed service. 103 | $result = sc.exe config $ServiceName start= demand 104 | Write-BISFLog -Msg "Result $result" 105 | } 106 | Else { 107 | Write-BISFLog -Msg "Service '$ServiceName' is not installed" 108 | } 109 | } 110 | } 111 | 112 | # Stopping multiple instances of PCCNTmon.exe processes running on the Terminal (RDS) server 113 | # https://success.trendmicro.com/solution/1102736 114 | function UpdateINIFile { 115 | $inifiles = @("${env:ProgramFiles(x86)}\Trend Micro\OfficeScan Client\ofcscan.ini","${env:ProgramFiles(x86)}\Trend Micro\Security Agent\ofcscan.ini") 116 | ForEach ($inifile in $inifiles) { 117 | If (Test-Path -Path "$inifile") { 118 | Write-BISFLog -Msg "Updating $inifile" -ShowConsole -SubMsg -Color DarkCyan 119 | $inicontents = Get-Content "$inifile" 120 | $inicontents = $inicontents | ForEach-Object { $_ -replace '^NT_RUN_KEY=.+$', "NT_RUN_KEY=" } 121 | $inicontents = $inicontents | ForEach-Object { $_ -replace '^NT_RUN_KEY_FILE_NAME=.+$', "NT_RUN_KEY_FILE_NAME=" } 122 | $inicontents | Set-Content $inifile 123 | # Note that you will get an access denied error when writing back to the ofcscan.ini file if the 124 | # services/processes are still running. 125 | } 126 | } 127 | } 128 | function DeleteRunValue { 129 | $keypath = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run" 130 | $values = @("OfficeScanNT Monitor") 131 | ForEach ($value in $values) { 132 | $IsValueMissing = (Get-ItemProperty $keypath).$value -eq $null 133 | If ($IsValueMissing -eq $False) { 134 | Write-BISFLog -Msg "Removing the $value value from the Run key" -ShowConsole -SubMsg -Color DarkCyan 135 | Remove-ItemProperty -path $keypath -name $value 136 | } 137 | } 138 | } 139 | 140 | ####### end functions ##### 141 | 142 | 143 | #### Main Program 144 | $svc = Test-BISFService -ServiceName $TMServices[0] -ProductName "$product" 145 | $ApexOne = Test-BISFService -ServiceName $TMServices[5] -ProductName "$product1" 146 | 147 | IF ($ApexOne) { 148 | Write-BISFLog -Msg "Skipping $product1 preparation" -Type W -ShowConsole -SubMsg 149 | Write-BISFLog -Msg "Please Checkout ApexOne Support https://github.com/EUCweb/BIS-F/issues/233 for further information" -Type W -ShowConsole -SubMsg 150 | start-sleep 10 151 | } ELSE { 152 | 153 | IF ($svc -eq $true) { 154 | #RunFullScan <<-currently not specified, see above... 155 | TerminateProcess 156 | StopService 157 | deleteTMData 158 | UpdateINIFile 159 | DeleteRunValue 160 | } 161 | } 162 | } 163 | 164 | End { 165 | Add-BISFFinishLine 166 | } -------------------------------------------------------------------------------- /Framework/SubCall/Personalization/99_PersBISF_StartUp.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Configure several System Startup Actions (SSA) 4 | .DESCRIPTION 5 | .EXAMPLE 6 | .NOTES 7 | Author: Matthias Schlimm 8 | 9 | History: 10 | 11.08.2015 BR: Script created 11 | 06.10.2015 MS: Rewritten script with standard .SYNOPSIS 12 | 22.03.2016 MS: Added SDelete to run on the WriteCacheDisk on PVS Target Devices only 13 | 10.11.2016 MS: SDelete will no longer be ditributed by BISF, it must be installed in C:\Windows\system32 14 | 12.03.2017 MS: get WCDrive from $LIC_BISF_CLI_WCD insted of PVSWriteCacheDisk System Variable, it can be configured via ADMX now 15 | 01.08.2017 MS: change sdeletePath, it can be set to a custom value 16 | 02.08.2017 MS: With DiskMode AppLayering in OS-Layer the WSUS Update Service would be start 17 | 29.10.2017 MS: replace VDA instead of MCS in the DiskMode Test 18 | 20.10.2018 MS: Bugfix 73: MCS Image in Private Mode does not start the Windows Update Service 19 | 18.08.2019 MS: ENH 101: Use sdelete64.exe on x64 system 20 | 05.10.2019 MS: ENH 12 - Configure sDelete for different environments 21 | 05.10.2019 MS: ENH 43 - sihclient.exe consumes CPU load with disabled WSUS Service (function invoke-sihTask) 22 | 18.02.2020 JK: Fixed Log output spelling 23 | 24 | .LINK 25 | https://eucweb.com 26 | #> 27 | 28 | Begin { 29 | $script_path = $MyInvocation.MyCommand.Path 30 | $script_dir = Split-Path -Parent $script_path 31 | $script_name = [System.IO.Path]::GetFileName($script_path) 32 | #sdelete 33 | IF ($OSBitness -eq "32-bit") { $sdeleteversion = "sdelete.exe" } ELSE { $sdeleteversion = "sdelete64.exe" } 34 | IF ($LIC_BISF_CLI_SD_SF -eq "1") { 35 | $SDeletePath = "$($LIC_BISF_CLI_SD_SF_CUS)\$sdeleteversion" 36 | } 37 | ELSE { 38 | $SDeletePath = "C:\Windows\system32\$sdeleteversion" 39 | } 40 | 41 | } 42 | 43 | Process { 44 | 45 | # region functions 46 | function start-sdelete { 47 | IF ($RunPersSdelete -eq $true) { 48 | IF ((Test-Path ("$SDeletePath") -PathType Leaf )) { 49 | $ProductFileVersion = (Get-Item "$SDeletePath").VersionInfo.FileVersion 50 | Write-BISFLog -Msg "Product SDelete $ProductFileVersion installed" -ShowConsole -Color Cyan 51 | IF ($ProductFileVersion -lt "2.02") { 52 | Write-BISFLog -Msg "WARNING: SDelete $ProductFileVersion is not supported, Please use Version 2.02 or newer !!" -ShowConsole -Type W 53 | Start-Sleep 20 54 | } 55 | ELSE { 56 | Write-BISFLog -Msg "Supported SDelete Version detected, processing configuration" -ShowConsole 57 | 58 | #Citrix PVS Image on the WriteCache Disk if the image is in shared image mode 59 | IF (($LIC_BISF_CLI_SD_runPVSCacheDisk -eq 1) -and ($DiskMode -eq "ReadOnly") -and ($LIC_BISF_CLI_WCD -ne "NONE")) { 60 | Write-BISFLog -Msg "Running SDelete on PVS WriteCacheDisk Drive $LIC_BISF_CLI_WCD" -ShowConsole -Color DarkCyan -SubMsg 61 | Start-BISFProcWithProgBar -ProcPath "$SDeletePath" -Args "-accepteula -z $($LIC_BISF_CLI_WCD)" -ActText "SDelete is running to Zero Out Free Space on drive $LIC_BISF_CLI_WCD" 62 | 63 | } 64 | 65 | #Citrix MCSIO on persistent CacheDisk if the image is in shared image mode 66 | IF (($LIC_BISF_CLI_SD_runMCSIO -eq 1) -and ($DiskMode -eq "VDAShared") -and ($LIC_BISF_CLI_MCSIODriveLetter -ne "NONE") -and ($MCSIO -eq $true)) { 67 | Write-BISFLog -Msg "Running SDelete on MCSIO CacheDisk Drive $LIC_BISF_CLI_MCSIODriveLetter" -ShowConsole -Color DarkCyan -SubMsg 68 | Start-BISFProcWithProgBar -ProcPath "$SDeletePath" -Args "-accepteula -z $($LIC_BISF_CLI_MCSIODriveLetter)" -ActText "SDelete is running to Zero Out Free Space on drive $LIC_BISF_CLI_MCSIODriveLetter" 69 | 70 | } 71 | 72 | #Citrix MCS on Systemdrive if the image is in shared image mode 73 | IF (($LIC_BISF_CLI_SD_runMCS -eq 1) -and ($DiskMode -eq "VDAShared") -and ($MCSIO -eq $false)) { 74 | Write-BISFLog -Msg "Running SDelete on MCS SystemDrive $env:SystemDrive" -ShowConsole -Color DarkCyan -SubMsg 75 | Start-BISFProcWithProgBar -ProcPath "$SDeletePath" -Args "-accepteula -z $($env:SystemDrive)" -ActText "SDelete is running to Zero Out Free Space on drive $env:SystemDrive" 76 | } 77 | } 78 | 79 | } 80 | ELSE { 81 | Write-BISFLog -Msg "SDelete could not detected in Path $SDeletePath" 82 | } 83 | } 84 | } 85 | 86 | function start-WUAserv { 87 | Write-BISFLog -Msg "Activating Windows Update Service" -ShowConsole -Color DarkCyan -SubMsg 88 | Invoke-BISFService -ServiceName wuauserv -Action Start -StartType Automatic 89 | } 90 | 91 | function Invoke-sihTask { 92 | 93 | param ( 94 | [parameter(Mandatory = $true)][string]$Mode 95 | ) 96 | 97 | $TaskName = "sih" 98 | $task = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue 99 | IF ($task) { 100 | Write-BISFLog -Msg "Scheduled Task $TaskNameexists" -ShowConsole -Color Cyan 101 | $TaskPathName = Get-ScheduledTask -TaskName $task | % { $_.TaskPath } 102 | Switch ($Mode) { 103 | Disable { 104 | Write-BISFLog -Msg "Disable Scheduled Task $TaskName" -ShowConsole -SubMsg -Color DarkCyan 105 | Disable-ScheduledTask -Taskname $ScheduledTaskList -TaskPath $TaskPathName | Out-Null 106 | } 107 | Enable { 108 | Write-BISFLog -Msg "Enable Scheduled Task $TaskName" -ShowConsole -SubMsg -Color DarkCyan 109 | Enable-ScheduledTask -Taskname $ScheduledTaskList -TaskPath $TaskPathName | Out-Null 110 | } 111 | 112 | Default { 113 | Write-BISFLog -Msg "Default Action selected, doing nothing" -ShowConsole -Color DarkCy 114 | } 115 | } 116 | } 117 | ELSE { 118 | Write-BISFLog -Msg "Scheduled Task $TaskName does NOT exist" -ShowConsole -SubMsg -Color DarkCyan 119 | } 120 | } 121 | 122 | #endregion 123 | 124 | Write-BISFLog -Msg "Running system startup actions if needed..." -ShowConsole -Color Cyan 125 | $Global:DiskMode = Get-BISFDiskMode 126 | Switch ($Diskmode) { 127 | ReadWrite { 128 | Write-BISFLog -Msg "Running Actions for $Diskmode DiskMode" -ShowConsole -Color DarkCyan -SubMsg 129 | start-WUAserv 130 | Invoke-sihTask -Mode Enable 131 | } 132 | ReadOnly { 133 | Write-BISFLog -Msg "Running Actions for $Diskmode DiskMode" -ShowConsole -Color DarkCyan -SubMsg 134 | Invoke-sihTask -Mode Disable 135 | start-sdelete 136 | } 137 | Unmanaged { 138 | Write-BISFLog -Msg "Running Actions for $Diskmode DiskMode" -ShowConsole -Color DarkCyan -SubMsg 139 | } 140 | VDAPrivate { 141 | Write-BISFLog -Msg "Running Actions for $Diskmode DiskMode" -ShowConsole -Color DarkCyan -SubMsg 142 | start-WUAserv 143 | Invoke-sihTask -Mode Enable 144 | } 145 | VDAShared { 146 | Write-BISFLog -Msg "Running Actions for $Diskmode DiskMode" -ShowConsole -Color DarkCyan -SubMsg 147 | Invoke-sihTask -Mode Disable 148 | start-sdelete 149 | } 150 | ReadWriteAppLayering { 151 | Write-BISFLog -Msg "Running Actions for $Diskmode DiskMode" -ShowConsole -Color DarkCyan -SubMsg 152 | IF ($CTXAppLayerName -eq "OS-Layer") { 153 | start-WUAserv 154 | Invoke-sihTask -Mode Enable 155 | } 156 | } 157 | ReadOnlyAppLayering { 158 | Write-BISFLog -Msg "Running Actions for $Diskmode DiskMode" -ShowConsole -Color DarkCyan -SubMsg 159 | Invoke-sihTask -Mode Disable 160 | start-sdelete 161 | } 162 | UnmanagedAppLayering { 163 | Write-BISFLog -Msg "Running Actions for $Diskmode DiskMode" -ShowConsole -Color DarkCyan -SubMsg 164 | IF ($CTXAppLayerName -eq "OS-Layer") { 165 | start-WUAserv 166 | Invoke-sihTask -Mode Enable 167 | } 168 | } 169 | VDAPrivateAppLayering { 170 | Write-BISFLog -Msg "Running Actions for $Diskmode DiskMode" -ShowConsole -Color DarkCyan -SubMsg 171 | IF ($CTXAppLayerName -eq "OS-Layer") { 172 | start-WUAserv 173 | Invoke-sihTask -Mode Enable 174 | } 175 | } 176 | VDASharedAppLayering { 177 | Write-BISFLog -Msg "Running Actions for $Diskmode DiskMode" -ShowConsole -Color DarkCyan -SubMsg 178 | Invoke-sihTask -Mode Disable 179 | } 180 | 181 | Default { Write-BISFLog -Msg "Default Action selected, doing nothing" -ShowConsole -Color DarkCyan } 182 | 183 | } 184 | 185 | } 186 | 187 | End { 188 | Add-BISFFinishLine 189 | } -------------------------------------------------------------------------------- /Framework/PersBISF_Start.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Personalization of the BaseImage for Image Management Software like PVS, MCS,VMware View, Mirosofft only environemnts, sysprep images 4 | .DESCRIPTION 5 | .EXAMPLE 6 | .NOTES 7 | Author: Matthias Schlimm 8 | 9 | 10 | History: 11 | 24.09.2012 MS: Script created 12 | 26.08.2013 MS: Removed $XA_GenPVS_Folder = $SubCall_Folder + "30_XA_GenPVS\" 13 | 16.09.2013 MS: Added customfolder 99_XX_Custom\30_XX_PersPVS 14 | 16.09.2013 MS: Load_PS_Folder -def_load_PS_Folder $LIB_Folder 15 | 17.09.2013 MS: Removed unused variable and get Foldernames fom LIB_Config 16 | 18.09.2013 MS: Replaced $date with $(Get-date) to get current timestamp at running scriptlines write to the logfile 17 | 18.09.2013 MS: Predefined $LIB & $Subcall folder 18 | 19.09.2013 MS: IF ($scripts -ne $null) 19 | 28.01.2014 MS: Changed Line 87 to $return = load_PS_Folder -def_load_PS_Folder $psfolder to get GlobalValues from LIB 20 | 10.03.2014 MS: Reviewed code 21 | 21.03.2014 MS: Last code change, before release to web 22 | 11.08.2014 MS: Defined single logf ile for Personalization like Pers_PVS_Target_Scripts_YYYYMMDD-HHMMSS.log 23 | 12.08.2014 MS: Changed from Logfilename from .log to .bis (BIS = BaseImageScripts) 24 | 14.08.2014 MS: Changed ForegroundColor Green Write-Host "Import Modules $Modules" -ForegroundColor Green 25 | 18.08.2014 MS: Added computername to logfilename $Global:LogFileName = "Pers_BIS_$($computer)_$timestamp.bis" 26 | 16.02.2015 MS: Changed to new structur to import modules 27 | 21.08.2015 MS: Changed Request 77 - remove all XX,XA,XD from al files and Scripts 28 | 04.10.2016 MS: Renamed Folder names for global architectural re-design 29 | 09.01.2017 MS: IF $DiskMode -eq "MCSPrivate" no personalization is running 30 | 16.08.2017 MS: Skip Device Personalization, based on Diskmode selected in ADMX 31 | 11.09.2017 MS: Writing PersSate "PersRunning" and "PersFinished" to BISF Registry to control running prep after pers first 32 | 12.09.2017 MS: Using array $PersState = $TaskStates[0-4] to set the right State in the registry instead of hardcoded value 33 | 03.10.2017 MS: Bugfix 215: writing wrong PersState to registry, preparation does not run in that case 34 | 13.08.2019 MS: ENH 121 - change filenameextension from bis to log 35 | 21.09.2019 MS: ENH 127 - Personalization is in Active State Override 36 | 05.10.2019 MS: ENH 144 - Enable Powershell Transcript 37 | 18.02.2020 JK: Grammar fixup 38 | 09.08.2020 MS: HF 272 - Central PERS Logs are missing the beginning 39 | .LINK 40 | https://eucweb.com 41 | #> 42 | 43 | Begin { 44 | $error.Clear() 45 | If ( $TerminateScript -is [system.object] ) { Remove-Variable TerminateScript } 46 | Clear-Host 47 | $computer = gc env:computername 48 | $timestamp = Get-Date -Format yyyyMMdd-HHmmss 49 | 50 | ## HF 272 - Central PERS Logs are missing the beginning 51 | $ERRORACTIONPREFERENCE = "STOP" 52 | try { 53 | $Global:LIC_BISF_LogShare = (Get-ItemProperty "HKLM:\SOFTWARE\Policies\Login Consultants\BISF" -Name "LIC_BISF_CLI_LS").LIC_BISF_CLI_LS 54 | } 55 | catch {$Global:LIC_BISF_LogShare = $null } 56 | 57 | $ERRORACTIONPREFERENCE = "Continue" 58 | 59 | 60 | ## ENH 144 - Powershell Transcript 61 | $ERRORACTIONPREFERENCE = "STOP" 62 | try { 63 | $WPTEnabled = (Get-ItemProperty "HKLM:\SOFTWARE\Policies\Login Consultants\BISF" -Name "LIC_BISF_CLI_LOG_WPT").LIC_BISF_CLI_LOG_WPT 64 | } 65 | catch { } 66 | 67 | IF ($WPTEnabled -eq 1) { 68 | $Global:WPTlog = "C:\Windows\Logs\PERS_BISF_WPT_$($computer)_$timestamp.log" 69 | Start-Transcript $WPTLog | Out-Null 70 | } 71 | $ERRORACTIONPREFERENCE = "Continue" 72 | 73 | # Setting default variables ($PSScriptroot/$logfile/$PSCommand,$PSScriptFullname/$scriptlibrary/LogFileName) independent on running script from console or ISE and the powershell version. 74 | If ($($host.name) -like "* ISE *") { 75 | # Running script from Windows Powershell ISE 76 | $PSScriptFullName = $psise.CurrentFile.FullPath.ToLower() 77 | $PSCommand = (Get-PSCallStack).InvocationInfo.MyCommand.Definition 78 | } 79 | ELSE { 80 | $PSScriptFullName = $MyInvocation.MyCommand.Definition.ToLower() 81 | $PSCommand = $MyInvocation.Line 82 | } 83 | [string]$PSScriptName = (Split-Path $PSScriptFullName -leaf).ToLower() 84 | If (($PSScriptRoot -eq "") -or ($PSScriptRoot -eq $null)) { [string]$PSScriptRoot = (Split-Path $PSScriptFullName).ToLower() } 85 | 86 | 87 | # define environment 88 | $Global:State = "Personalization" 89 | $Global:LogFileName = 90 | $Global:Main_Folder = $PSScriptRoot 91 | $Global:SubCall_Folder = $PSScriptRoot + "\SubCall\" 92 | $Global:LIB_Folder = $SubCall_Folder + "Global\" 93 | $Global:LogFileName = "PERS_BISF_$($computer)_$timestamp.log" 94 | $Global:LOGFile = "C:\Windows\Logs\$LogFileName" 95 | $Global:LOG = $LOGFile 96 | 97 | } 98 | 99 | Process { 100 | #load BISF Modules 101 | try { 102 | $Modules = @(Get-ChildItem -path $LIB_Folder -filter "*.psd1" -Force) 103 | ForEach ($module in $Modules) { 104 | $modulename = (Test-ModuleManifest $($Module.FullName) -Verbose:$false).Name 105 | $global:mainmodulename = $modulename 106 | $modulecompany = (Test-ModuleManifest $($Module.FullName) -Verbose:$false).CompanyName 107 | Write-Host "--- Importing Module $modulename ---" -ForegroundColor Green -BackgroundColor DarkGray 108 | Import-Module -Name $($Module.FullName) -Force 109 | } 110 | } 111 | catch { 112 | Throw "An error occured while loading modules. The error is: $_" 113 | Exit 1 114 | } 115 | 116 | # Initialize all variables used by BISF 117 | Initialize-BISFConfiguration 118 | 119 | #Personalization is in Active State Override 120 | IF ($LIC_BISF_CLI_PersonalizationOverride -eq 2 ) { 121 | Write-BISFLog "Personalization Active State override is set to: Change and continue" 122 | $PersState = $TaskStates[3] 123 | } 124 | ELSE { 125 | Write-BISFLog "Personalization Active State override is set to: Do not change and wait" 126 | $PersState = $TaskStates[2] 127 | } 128 | Write-BISFLog -Msg "Write PersState to registry location Path: $hklm_software_LIC_CTX_BISF_SCRIPTS -Name: LIC_BISF_PersState -Value: $PersState" 129 | Set-ItemProperty -Path $hklm_software_LIC_CTX_BISF_SCRIPTS -Name "LIC_BISF_PersState" -value "$PersState" -Force #-ErrorAction SilentlyContinue 130 | 131 | 132 | #Migrate Settings from PVS to BISF 133 | Convert-BISFSettings 134 | 135 | #Load Global environment 136 | $psfolder = $LIB_Folder 137 | Invoke-BISFFolderScripts -Path "$psfolder" -Verbose:$VerbosePreference 138 | $PersState = $TaskStates[3] 139 | Switch ($LIC_BISF_CLI_DM) { 140 | #Skip Device Personalization, based on ADMX configuration 141 | All { 142 | Start-BISFCDS 143 | Write-BISFLog -Msg "Write PersState to registry location Path: $hklm_software_LIC_CTX_BISF_SCRIPTS -Name: LIC_BISF_PersState -Value: $PersState" 144 | Set-ItemProperty -Path $hklm_software_LIC_CTX_BISF_SCRIPTS -Name "LIC_BISF_PersState" -value "$PersState" -Force #-ErrorAction SilentlyContinue 145 | Write-BISFLog -Msg "Image in Mode $DiskMode, skip device personalization (configured: all)" -Type E -SubMsg; Exit 146 | } 147 | Never { Write-BISFLog -Msg "Image in Mode $DiskMode, device personalization will not be skipped (configured: never)" -ShowConsole -Color DarkCyan } 148 | ReadWrite { 149 | IF (($DiskMode -match "Private") -or ($DiskMode -match "ReadWrite")) { 150 | Start-BISFCDS 151 | Write-BISFLog -Msg "Write PersState to registry location Path: $hklm_software_LIC_CTX_BISF_SCRIPTS -Name: LIC_BISF_PersState -Value: $PersState" 152 | Set-ItemProperty -Path $hklm_software_LIC_CTX_BISF_SCRIPTS -Name "LIC_BISF_PersState" -value "$PersState" -Force #-ErrorAction SilentlyContinue 153 | Write-BISFLog -Msg "Image in Mode $DiskMode, skip device personalization (configured: Private Mode) " -Type E -SubMsg; Exit 154 | } 155 | ELSE 156 | { Write-BISFLog -Msg "Image in Mode $DiskMode, device personalization will not be skipped (configured: Private Mode)" -ShowConsole -Color DarkCyan } 157 | } 158 | Default { Write-BISFLog -Msg "Default Action selected, device personalization will not be skipped (not configured in ADMX)" -ShowConsole -Color DarkCyan } 159 | } 160 | Add-BISFFinishLine 161 | 162 | #load predefined scripts 163 | $psfolder = $SubCall_Folder + "Personalization" 164 | Invoke-BISFFolderScripts -Path "$psfolder" -Verbose:$VerbosePreference 165 | 166 | Add-BISFFinishLine 167 | 168 | #load custom scripts 169 | $psfolder = $SubCall_Folder + "Personalization\Custom" 170 | Invoke-BISFFolderScripts -Path "$psfolder" -Verbose:$VerbosePreference 171 | 172 | Start-BISFCDS # Start the Citrix Desktop Service, if configured through ADMX 173 | 174 | $PersState = $TaskStates[3] 175 | Write-BISFLog -Msg "Write PersState to registry location Path: $hklm_software_LIC_CTX_BISF_SCRIPTS -Name: LIC_BISF_PersState -Value: $PersState" 176 | Set-ItemProperty -Path $hklm_software_LIC_CTX_BISF_SCRIPTS -Name "LIC_BISF_PersState" -value "$PersState" -Force #-ErrorAction SilentlyContinue 177 | 178 | } 179 | 180 | End { 181 | try { 182 | Write-BISFLog -Msg "- - - End Of Script - - - " 183 | #unload BISF Modules 184 | $Modules = @(Get-ChildItem -path $LIB_Folder -filter "*.psd1" -Force) 185 | ForEach ($module in $Modules) { 186 | $modulename = (Test-ModuleManifest $($Module.FullName)).Name 187 | $modulecompany = (Test-ModuleManifest $($Module.FullName)).CompanyName 188 | Write-Host "--- Removing Module $modulename ---" -ForegroundColor Green -BackgroundColor DarkGray 189 | Remove-Module -Name $modulename -Force -ErrorAction Stop 190 | } 191 | } 192 | catch { 193 | Throw "An error occured while unloading modules. The error is:`r`n$_" 194 | Exit 1 195 | } 196 | IF ($WPTEnabled -eq 1) { Stop-Transcript -ErrorAction SilentlyContinue | Out-Null } 197 | } -------------------------------------------------------------------------------- /Framework/SubCall/Personalization/02_PersBISF_CTX.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Personalize Citrix for Image Management Software 4 | .DESCRIPTION 5 | .EXAMPLE 6 | .NOTES 7 | Author: Matthias Schlimm 8 | Company: EUCWeb.com 9 | 10 | History: 11 | 22.08.2013 MS: Script created 12 | 17.09.2013 MS: Added last line to log file and remove Clear-Host 13 | 18.09.2013 MS: Replaced $date with $(Get-date) to get current timestamp at running scriptlines write to the logfile 14 | 18.03.2014 MS: Review Code and linked to new central functions like Write-BISFLog 15 | 13.08.2014 MS: Removed $logfile = Set-logFile, it would be used in the 10_XX_LIB_Config.ps1 Script only 16 | 17.08.2014 MS: Changed line 36 to $Location = "$ProgramFilesx86\Citrix\system32\CtxSta.config" 17 | 06.10.2015 MS: Rewritten script with standard .SYNOPSIS 18 | 03.11.2015 MS: Configure Citrix license file cache location and set NTFS Permissions for NetworkService with full access 19 | 10.11.2016 MS: Typo in Line 76, thx to Mikhail Zuskov - Write-BISFLog -Msg "Error changing access for NetworkService on the folder `"$LIC_BISF_CtxCache`". The output of the action is: $result" -Type W -SubMsg 20 | 18.01.2017 MS: Bug 127; fixed with new script from Citrix - https://docs.citrix.com/en-us/xenapp-and-xendesktop/7-12/whats-new/known-issues.html 21 | 18.04.2017 MS: reset Performance Counters with installed Citrix VDA only 22 | 21.10.2028 MS: Bufix 47: MSMQ windows services will fail to start in App Layering 23 | 21.10.2028 MS: Bufix 18: XA/ XD 7.x Cache folder will be created 24 | 18.02.2020 JK: Fixed Log output spelling 25 | 23.12.2020 MS: HF 304: WEM Agent 2009 or greater, new startup Options can be used 26 | 08.05.2023 MS: HF 374 - 02_PersBISF_CTX.ps1 never finishes on Azure AD only Azure VMs 27 | 28 | .LINK 29 | https://eucweb.com 30 | #> 31 | 32 | Begin { 33 | # Define environment 34 | $SysDrive = gc env:systemdrive 35 | $TEMP = gc env:temp 36 | $Sta = "STA$computer" 37 | $Service = "CtxHTTP" 38 | $PSScriptFullName = $MyInvocation.MyCommand.Path 39 | $PSScriptRoot = Split-Path -Parent $PSScriptFullName 40 | $PSScriptName = [System.IO.Path]::GetFileName($PSScriptFullName) 41 | $Location = "$ProgramFilesx86\Citrix\system32\CtxSta.config" 42 | $REG_CTX_INSTALL = "$hklm_software\WOW6432Node\Citrix\Install" 43 | } 44 | 45 | Process { 46 | 47 | # Configure STA-File 48 | Write-BISFLog -Msg "Check Citrix STA in $location" 49 | IF (Test-Path -Path $Location) { 50 | 51 | Write-BISFLog -Msg "Defined STA: $sta" 52 | 53 | # Replace STA ID with Computerhostname 54 | (Get-Content $Location) | ForEach-Object { $_ -replace '^UID=.+$', "UID=$Sta" } | Set-Content $Location 55 | Write-BISFLog -Msg "Set STA in File $Location" 56 | 57 | #Check Service 58 | If (Get-Service $Service -ErrorAction SilentlyContinue) { 59 | Restart-Service $Service 60 | Write-BISFLog -Msg "XenApp Controller Mode - Restart $Service Service" -Color Cyan 61 | } 62 | Else { 63 | Write-BISFLog -Msg "XenApp Session Host Mode - No $Service Service" 64 | } 65 | } 66 | Else { 67 | Write-BISFLog -Msg "STA file $location not found" 68 | } 69 | 70 | #Configure Citrix LicenseFile Cache Location 71 | IF (!($returnTestXDSoftware -eq "true")) { 72 | If (Test-Path -Path "$LIC_BISF_LogPath") { 73 | Write-BISFLog -Msg "Configure Citrix cache location" 74 | If (!(Test-Path -Path $LIC_BISF_CtxCache)) { 75 | Write-BISFLog -Msg "Create Citrix cache location $LIC_BISF_CtxCache" -SubMsg 76 | New-Item -Path "$LIC_BISF_CtxCache" -ItemType Directory -Force 77 | 78 | Try { 79 | $result = Invoke-Expression -Command "icacls.exe `"$LIC_BISF_CtxCache`" /grant *S-1-5-20:(OI)(CI)(F)" 80 | Write-BISFLog -Msg "Added NetworkService account permissions on the folder `"$LIC_BISF_CtxCache`" " -ShowConsole -Color DarkCyan -SubMsg 81 | } 82 | Catch { 83 | Write-BISFLog -Msg "Error changing access for NetworkService account on the folder `"$LIC_BISF_CtxCache`". The output of the action is: $result" -Type W -SubMsg 84 | } 85 | 86 | 87 | 88 | } 89 | Else { 90 | Write-BISFLog -Msg "Citrix cache location $LIC_BISF_CtxCache already exists" -SubMsg 91 | } 92 | } 93 | Else { 94 | Write-BISFLog -Msg "PVSWriteCache not available, skipping Citrix license cache location preparation" 95 | } 96 | } 97 | ELSE { 98 | Write-BISFLog -MSG "Citrix VDA installed, skipping Citrix license cache location" 99 | } 100 | 101 | $Servicename = "MSMQ" 102 | $Svc = Test-BISFService -ServiceName "$servicename" 103 | If ($Svc) { 104 | Write-BISFLog -Msg "Delete old QMId from registry and set Sysprep flag for MSMQ" 105 | Remove-ItemProperty -Path $hklm_software\Microsoft\MSMQ\Parameters\MachineCache -Name QMId -Force 106 | Set-ItemProperty -Path $hklm_software\Microsoft\MSMQ\Parameters -Name "SysPrep" -Type DWord -Value 1 107 | Set-ItemProperty -Path $hklm_software\Microsoft\MSMQ\Parameters -Name "LogDataCreated" -Type DWord -Value 0 108 | Write-BISFLog -Msg "Get dependent services" 109 | $depServices = Get-Service -Name MSMQ -DependentServices | select -Property Name 110 | Write-BISFLog -Msg "Restart MSMQ to get a new QMId" 111 | Restart-Service -Force MSMQ 112 | Write-BISFLog -Msg "Start dependent services" 113 | If ($DepServices -ne $Null) { 114 | Foreach ($DepService in $DepServices) { 115 | $StartMode = Get-CimInstance -ClassName Win32_Service -Filter "NAME = '$($DepService.Name)'" | Select-Object -Property StartMode 116 | If ($StartMode.StartMode -eq "Auto") { 117 | Start-Service $DepService.Name 118 | } 119 | } 120 | 121 | } 122 | } 123 | 124 | ## Citrix XenDesktop / XenApp VDA only 125 | IF ($returnTestXDSoftware -eq "true") { 126 | Write-BISFLog -Msg "Performing actions for Citrix VDA only" -ShowConsole -Color Cyan 127 | $PerfCounters = $LIC_BISF_CLI_PF 128 | IF ($PerfCounters -eq "YES") { 129 | Write-BISFLog -Msg "reset Performance Counters" -ShowConsole -Color DarkCyan -SubMsg 130 | Start-BISFProcWithProgBar -ProcPath "lodctr.exe" -Args "/r" -ActText "reset Performance Counters" 131 | 132 | } 133 | ELSE { 134 | Write-BISFLog -Msg "reset Performance Counters is not enabled in ADMX" -ShowConsole -Type W -SubMsg 135 | } 136 | } 137 | 138 | #Citrix Workspace Environment Management Agent 139 | <# 140 | .SYNOPSIS 141 | During personalizatition the WEM Agent is refresh the cache 142 | .DESCRIPTION 143 | 144 | .EXAMPLE 145 | 146 | .NOTES 147 | Author: Matthias Schlimm 148 | 149 | History: 150 | 29.07.2017 MS: ENH 174: on systemstartup with MCS/PVS and installed WEM Agent - refresh WEM Cache 151 | 24.08.2017 MS: HF: after restart WEM Agentservice, Netlogon must be started also 152 | 11.09.2017 MS: WEM AgentCacheRefresh can be using without the WEM Brokername specified from WEM ADMX 153 | 03.10.2019 MS: ENH 139 - WEM 1909 detection (tx to citrixguyblog / chezzer64) 154 | 08.05.2023 MS: HF 374 - 02_PersBISF_CTX.ps1 never finishes on Azure AD only Azure VMs 155 | 156 | .LINK 157 | https://eucweb.com 158 | #> 159 | 160 | $services = "Norskale Agent Host Service", "WemAgentSvc" 161 | 162 | foreach ($service in $services) { 163 | if ($service -eq "Norskale Agent Host Service") { 164 | $product = "Citrix Workspace Environment Management (WEM) Legacy Agent" 165 | } 166 | 167 | else { $product = "Citrix Workspace Environment Management (WEM) Agent" } 168 | 169 | $svc = Test-BISFService -ServiceName "$service" -ProductName "$product" -RetrieveVersion 170 | 171 | IF ($svc[0] -eq $true) { 172 | $servicename = $service 173 | Invoke-BISFService -ServiceName "$servicename" -Action Stop 174 | Start-Sleep $Wait1 175 | Invoke-BISFService -ServiceName "$servicename" -Action Start 176 | IF ((Get-BISFDSRegState -Key "AzureAdJoined" -eq "YES") -and (Get-BISFDSRegState -Key "DomainJoined" -eq "NO")) { 177 | Write-BISFLog -Msg "VM is AAD joined only, Netlogon Service will not be started." 178 | } else { 179 | Write-BISFLog -Msg "VM is Hybrid joined (AAD + AD), Netlogon Service will be started now." 180 | Invoke-BISFService -ServiceName "Netlogon" -Action Start 181 | Start-Sleep $Wait1 182 | } 183 | 184 | 185 | #read WEM AgentAlternateCacheLocation from registry 186 | $REG_WEMAgent = "HKLM:\SYSTEM\CurrentControlSet\Control\Norskale\Agent Host" 187 | $WEMAgentLocation = (Get-ItemProperty $REG_WEMAgent).AgentLocation 188 | Write-BISFLog -Msg "WEM Agent Location: $WEMAgentLocation" 189 | 190 | 191 | #Read WEM Agent Host BrokerName from registry 192 | #Check if WEM is installed On-Prem or in Cloud Mode 193 | $REG_WEMAgentHost = "HKLM:\SOFTWARE\Policies\Norskale\Agent Host" 194 | 195 | if (Get-ItemProperty $REG_WEMAgentHost -Name "BrokerSvcName") { 196 | $WEMAgentHostBrokerName = (Get-ItemProperty $REG_WEMAgentHost).BrokerSvcName 197 | IF (!$WEMAgentHostBrokerName) { Write-BISFLog -Msg "WEM Agent BrokerName not specified through WEM ADMX" } ELSE { Write-BISFLog -Msg "WEM Agent BrokerName: $WEMAgentHostBrokerName" } 198 | } 199 | 200 | 201 | if (Get-ItemProperty $REG_WEMAgentHost -Name "CloudConnectorList") { 202 | $WEMAgentHostBrokerName = (Get-ItemProperty $REG_WEMAgentHost).CloudConnectorList 203 | IF (!$WEMAgentHostBrokerName) { Write-BISFLog -Msg "WEM Agent CloudConnector not specified through WEM ADMX" } ELSE { Write-BISFLog -Msg "WEM Agent CloudConnector: $WEMAgentHostBrokerName" } 204 | } 205 | 206 | $WEMAgentCacheUtil = "$WEMAgentLocation" + "AgentCacheUtility.exe" 207 | $WEMAgentVersion = $svc[1] #HF 304: new Startup Options via BIS-F ADMX 208 | IF ($WEMAgentVersion -gt "2012*" ) { 209 | $AgentArgs = $LIC_BISF_CLI_WEMCacheStartupOption 210 | } 211 | 212 | IF ([String]::IsNullOrEmpty($AgentArgs)) { 213 | $AgentArgs = "-RefreshCache" 214 | Write-BISFLog -Msg "WEM Agent Startup Options set to default value: $AgentArgs" -ShowConsole -Color Yellow -SubMsg -Type W 215 | } 216 | 217 | 218 | Write-BISFLog -Msg "WEM Agent Version $WEMAgentVersion detected, StartupOption: $AgentArgs used" -ShowConsole -Color DarkCyan -SubMsg 219 | 220 | Write-BISFLog -Msg "Running Agent Cache Management Utility with $product BrokerName $WEMAgentHostBrokerName " -ShowConsole -Color DarkCyan -SubMsg 221 | Start-BISFProcWithProgBar -ProcPath "$WEMAgentCacheUtil" -Args $AgentArgs -ActText "Running Agent Cache Management Utility" | Out-Null 222 | } 223 | } 224 | 225 | } 226 | 227 | End { 228 | Add-BISFFinishLine 229 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_RES.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare RES One Workspace Management, RES ONE Automation and RES ONE Service Store Software for Image Managemement 4 | .DESCRIPTION 5 | Delete computer specific entries 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | 10 | Thanks to Company RES Germany: Oliver Lomberg & Nina Metz for additional enhacements informations to create this script 11 | 12 | History: 13 | 10.01.2017 MS: Initial Script Created 14 | 24.01.2017 MS: Workspace Manager and AutomationManager; In Citrix PVS if an alternate DBCache Path is already configured, BIS-F does not configured anymore 15 | 30.01.2017 MS: RES Workspace Manager: add IF (Test-Path "$HKLM_WIN_CVN\WUID") {Remove-Item -Path "$HKLM_WIN_CVN\WUID"} 16 | 31.01.2017 MS: Added RES ONE Automation Console stop service 17 | 31.01.2017 MS: RES Workspace: change Remove-Item -Path "$InstallDir_REG\Data\DBCache\Resources\custom_resources\*" -recurse 18 | 01.02.2017 MS: Bugfix wrong syntax for RES ONE Automation Console 19 | 15.03.2017 MS: added Support for RES ONE Automation Agent Version 10 with new path in registry and filesystem 20 | 03.04.2017 MS: BugFix - RES Workspace: wrong Path in Workspace Agent, change from DBCache to LocalCachePath 21 | 03.04.2017 MS: BugFix - RES Workspace: delete not all folders in the CachePath 22 | 12.07.2017 FF: BugFix for Redirecting RES Cache (Setting Cache Path to WCD) 23 | 21.09.2017 MS: Feature: RES Automation Agent Service could be controlled from ADMX 24 | 04.05.2019 MS: BugFix 82 - RES ONE Automation Agent - Action is missing 25 | 14.08.2019 MS: FRQ 3 - Remove Messagebox and using default setting if GPO is not configured 26 | 27 | 17.08.2019 MS: ENH 78: Sealing for Ivanti Automation agent can be disabled in ADMX 28 | 18.02.2020 JK: Fixed Log output spelling 29 | 30 | .LINK 31 | https://eucweb.com 32 | #> 33 | 34 | Begin { 35 | 36 | #################################################################### 37 | # define environment 38 | $PSScriptFullName = $MyInvocation.MyCommand.Path 39 | $PSScriptRoot = Split-Path -Parent $PSScriptFullName 40 | $PSScriptName = [System.IO.Path]::GetFileName($PSScriptFullName) 41 | 42 | #product specified 43 | 44 | $Prd1 = "RES ONE Workspace Agent" 45 | $Svc1 = "RES" 46 | 47 | $Prd2 = "RES ONE Automation Console" 48 | $Svc2 = "RESWCS" 49 | 50 | $Prd3 = "RES ONE Automation" 51 | $Svc3 = "RESWAS" 52 | 53 | $Prd4 = "RES ONE Service Store Client Service" 54 | $Svc4 = "RESOCWSVC" 55 | 56 | $HKLM_REG_ROW = "$HKLM_sw_x86\RES\Workspace Manager" 57 | $HKLM_REG_ROA = @() # would be set in the RES ONE Automation Agent section, because of different path between RES Versions 9 and 10 58 | $HKLM_WIN_CVN = "$HKLM_sw_x86\Microsoft\Windows\CurrentVersion" 59 | 60 | #################################################################### 61 | } 62 | 63 | Process { 64 | 65 | 66 | #RES ONE Workspace Agent 67 | $svc = Test-BISFService -ServiceName $Svc1 -ProductName $Prd1 68 | IF ($svc) { 69 | Invoke-BISFService -ServiceName $Svc1 -Action Stop 70 | Write-BISFLog -Msg "Prepare for Imaging..." 71 | Invoke-BISFService -ServiceName "RESPESVC" -Action Stop 72 | 73 | $TestROWValue = Test-BISFRegistryValue -Path "$HKLM_REG_ROW" -Value "CachedSystemInfo" 74 | IF ($TestROWValue) { Remove-ItemProperty -Path "$HKLM_REG_ROW" -Name "CachedSystemInfo" } 75 | 76 | $TestROWValue = Test-BISFRegistryValue -Path "$HKLM_REG_ROW" -Value "CachedSystemInfoEx" 77 | IF ($TestROWValue) { Remove-ItemProperty -Path "$HKLM_REG_ROW" -Name "CachedSystemInfoEx" } 78 | 79 | $TestROWValue = Test-BISFRegistryValue -Path "$HKLM_REG_ROW" -Value "ComputerGUID" 80 | IF ($TestROWValue) { Remove-ItemProperty -Path "$HKLM_REG_ROW" -Name "ComputerGUID" } 81 | 82 | $TestROWValue = Test-BISFRegistryValue -Path "$HKLM_REG_ROW" -Value "LastSyncUTC" 83 | IF ($TestROWValue) { Remove-ItemProperty -Path "$HKLM_REG_ROW" -Name "LastSyncUTC" } 84 | 85 | IF (Test-Path "$HKLM_REG_ROW\UpdateGUIDs") { Remove-Item -Path "$HKLM_REG_ROW\UpdateGUIDs" } 86 | 87 | IF (Test-Path "$HKLM_WIN_CVN\WUID") { Remove-Item -Path "$HKLM_WIN_CVN\WUID" } 88 | 89 | $TestROWValue = Test-BISFRegistryValue -Path "$HKLM_REG_ROW" -Value "LocalCachePath" 90 | IF ($TestROWValue) { 91 | $LocalCachePath_REG = Get-ItemProperty -path "$HKLM_REG_ROW" | % { $_.LocalCachePath } 92 | Write-BISFLog -Msg "LocalCachePath is set to $LocalCachePath_REG and would deleted now" 93 | IF (Test-Path $LocalCachePath_REG) { Remove-Item -Path "$LocalCachePath_REG" -recurse -force } 94 | } 95 | ELSE { 96 | $InstallDir_REG = Get-ItemProperty -path "$HKLM_REG_ROW" | % { $_.InstallDir } 97 | 98 | IF (Test-Path $InstallDir_REG) { 99 | Write-BISFLog -Msg "DB Cache is set to $InstallDir_REG\Data\DBCache and will be deleted now" 100 | Remove-Item -Path "$InstallDir_REG\Data\DBCache" -recurse 101 | } 102 | ELSE { 103 | Write-BISFLog -Msg "DB Cache is set to $InstallDir_REG\Data\DBCache and could NOT be deleted" -Type W -SubMsg 104 | 105 | } 106 | } 107 | 108 | IF ($returnTestPVSSoftware -eq "true") { 109 | 110 | Write-BISFLog -Msg "Citrix PVS Target Device Driver installed" -SubMsg -ShowConsole -Color DarkCyan 111 | $ROWCachePath = (Get-ItemProperty "$HKLM_REG_ROW").DBCache 112 | $ROWCachePathDrive = $ROWCachePath.substring(0, 2) 113 | IF ($PVSDiskDrive -eq $ROWCachePathDrive) { 114 | Write-BISFLog -Msg "RES Workspace Manager DBCache is already redirected $ROWCachePath" -SubMsg -ShowConsole -Color DarkCyan 115 | } 116 | ELSE { 117 | $ROWCachePath = "$PVSDiskDrive\RES\Workspace Manager\DBCache" 118 | Write-BISFLog -Msg "Redirecting RES ONE Workspace Agent DBCache to $ROWCachePath" -SubMsg -ShowConsole -Color DarkCyan 119 | Set-ItemProperty -Path "$HKLM_REG_ROW" -Name "LocalCachePath" -Value "$ROWCachePath" 120 | Set-ItemProperty -Path "$HKLM_REG_ROW" -Name "LocalCacheOnDisk" -Value "YES" 121 | } 122 | } 123 | } 124 | 125 | #RES ONE Automation Console 126 | $svc = Test-BISFService -ServiceName $Svc2 -ProductName $Prd2 127 | IF ($svc) { 128 | Invoke-BISFService -ServiceName $Svc2 -Action Stop 129 | } 130 | 131 | #RES ONE Automation 132 | $svc = Test-BISFService -ServiceName $Svc3 -ProductName $Prd3 133 | IF ($svc) { 134 | IF ($LIC_BISF_CLI_RA_SVC -eq "YES") { Invoke-BISFService -ServiceName $Svc3 -Action Stop } ELSE { Write-BISFLog -Msg "$Prd3 Service would not stopped (ADMX configuration)" -SubMsg -ShowConsole -Color DarkCyan } 135 | IF ($LIC_BISF_CLI_RA_SEAL -ne "YES") { 136 | Write-BISFLog -Msg "Prepare $Prd3 for Imaging..." 137 | $glbSVCImagePath = $glbSVCImagePath.split("\")[1] #get $SVCImagePath from Test-BISFService and split them to get ProgramFiles or ProgramFiles(x86) only 138 | IF ($glbSVCImagePath -eq "Program Files") { 139 | $HKLM_REG_ROA = "$hklm_software\RES\AutomationManager" 140 | $Inst_Path_ROA = "C:\$glbSVCImagePath\RES\Automation\Agent" 141 | } 142 | ELSE { 143 | $HKLM_REG_ROA = "$HKLM_sw_x86\RES\AutomationManager" 144 | $Inst_Path_ROA = "C:\$glbSVCImagePath\RES Software\Automation Manager\Agent" 145 | } 146 | Write-BISFLog -Msg "RES ROA Registry Path: $HKLM_REG_ROA" 147 | Write-BISFLog -Msg "RES ROA Install Path: $Inst_Path_ROA" 148 | 149 | $TestROAValue = Test-BISFRegistryValue -Path "$HKLM_REG_ROA\Agent" -Value "CachedDispatchers" 150 | IF ($TestROAValue) { Remove-ItemProperty -Path "$HKLM_REG_ROA\Agent" -Name "CachedDispatchers" } 151 | 152 | $TestROAValue = Test-BISFRegistryValue -Path "$HKLM_REG_ROA\Agent" -Value "CommunicationID" 153 | IF ($TestROAValue) { Remove-ItemProperty -Path "$HKLM_REG_ROA\Agent" -Name "CommunicationID" } 154 | 155 | $TestROAValue = Test-BISFRegistryValue -Path "$HKLM_REG_ROA\Agent" -Value "DispatcherListKGC" 156 | IF ($TestROAValue) { Remove-ItemProperty -Path "$HKLM_REG_ROA\Agent" -Name "DispatcherListKGC" } 157 | 158 | Set-ItemProperty -Path "$HKLM_REG_ROA\Agent" -Name "Prepared4Image" -Value "BISFStaging" 159 | 160 | $TestROAValue = Test-BISFRegistryValue -Path "$HKLM_REG_ROA\Preferences" -Value "WUID" 161 | IF ($TestROAValue) { Remove-ItemProperty -Path "$HKLM_REG_ROA\Preferences" -Name "WUID" } 162 | 163 | IF (Test-Path "$HKLM_WIN_CVN\WUID") { Remove-Item -Path "$HKLM_WIN_CVN\WUID" } 164 | 165 | $TestROAValue = Test-BISFRegistryValue -Path "$HKLM_REG_ROA\Agent" -Value "LastKnownResourceCacheFolder" 166 | IF ($TestROAValue) { 167 | $LastKnownResourceCacheFolder_REG = Get-ItemProperty -path "$HKLM_REG_ROA" | % { $_.LastKnownResourceCacheFolder } 168 | Write-BISFLog -Msg "LastKnownResourceCacheFolder is set to $LastKnownResourceCacheFolder_REG and would deleted now" 169 | IF (Test-Path $LastKnownResourceCacheFolder_REG) { Remove-Item -Path "$LastKnownResourceCacheFolder_REG\*" -recurse } 170 | } 171 | ELSE { 172 | $ROA_StdPath = "$Inst_Path_ROA\Workspace" 173 | IF (Test-Path $ROA_StdPath) { 174 | Write-BISFLog -Msg "Standardpath is set to $ROA_StdPath and will be deleted now" 175 | Remove-Item -Path "$ROA_StdPath\*" -recurse 176 | } 177 | ELSE { 178 | Write-BISFLog -Msg "Standardpath is set to $ROA_StdPath and could NOT be deleted" -Type W -SubMsg 179 | } 180 | } 181 | } 182 | ELSE { 183 | Write-BISFLog -Msg "Sealing for $Prd3 is skipped from GPO configuration" -Type W -SubMsg 184 | } 185 | 186 | IF ($returnTestPVSSoftware -eq "true") { 187 | Write-BISFLog -Msg "Citrix PVS Target Device Driver installed" -SubMsg -ShowConsole -Color DarkCyan 188 | $ROACachePath = (Get-ItemProperty "$HKLM_REG_ROA\Agent").LastKnownResourceCacheFolder 189 | $ROACachePathDrive = $ROACachePath.substring(0, 2) 190 | IF ($PVSDiskDrive -eq $ROACachePathDrive) { 191 | Write-BISFLog -Msg "RES Automation Manager DBCache is already redirected to $ROACachePath" -SubMsg -ShowConsole -Color DarkCyan 192 | } 193 | ELSE { 194 | $ROACachePath = "$PVSDiskDrive\RES\Automation Manager\DBCache" 195 | Write-BISFLog -Msg "Redirect RES ONE Automation Manager Agent DBCache to $ROACachePath" -SubMsg -ShowConsole -Color DarkCyan 196 | Set-ItemProperty -Path "$HKLM_REG_ROA\Agent" -Name "LastKnownResourceCacheFolder" -Value "$ROACachePath" 197 | } 198 | } 199 | 200 | Write-BISFLog -Msg "Check GPO Configuration" -SubMsg -Color DarkCyan 201 | $varCLI = $LIC_BISF_CLI_RA 202 | IF (($varCLI -eq "YES") -or ($varCLI -eq "NO")) { 203 | Write-BISFLog -Msg "GPO Valuedata: $varCLI" 204 | } 205 | ELSE { 206 | Write-BISFLog -Msg "GPO not configured.. using default setting" -SubMsg -Color DarkCyan 207 | $ROADisableSVC = "NO" 208 | } 209 | 210 | If (($ROADisableSVC -eq "YES" ) -or ($varCLI -eq "YES")) { 211 | Write-BISFLog -Msg "reconfigure Service... please Wait" 212 | Invoke-BISFService -ServiceName "$Svc3" -StartType Disabled -Action Stop 213 | 214 | } 215 | ELSE { 216 | Write-BISFLog -Msg "Sealing for $Prd3 is disabled in GPO" -ShowConsole -SubMSg -Type W 217 | } 218 | } 219 | 220 | #RES ONE Service Store Client Service 221 | $svc = Test-BISFService -ServiceName $Svc4 -ProductName $Prd4 222 | IF ($svc) { 223 | Invoke-BISFService -ServiceName $Svc4 -Action Stop 224 | } 225 | 226 | } 227 | 228 | End { 229 | Add-BISFFinishLine 230 | } -------------------------------------------------------------------------------- /Framework/SubCall/Preparation/10_PrepBISF_AV-McAfee.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Prepare McAfee Agent for Image Managemement 4 | .DESCRIPTION 5 | Delete computer specific entries 6 | .EXAMPLE 7 | .NOTES 8 | Author: Matthias Schlimm 9 | 10 | History 11 | 10.12.2014 JP: Script created 12 | 15.12.2014 JP: Added automatic virus definitions updates 13 | 06.02.2015 MS: Reviewed script 14 | 19.02.2015 MS: Fixed some errors and add progress bar for running scan 15 | 01.10.2015 MS: Rewritten script with standard .SYNOPSIS, use central BISF function to configure service 16 | 05.01.2017 JP: Added maconfig.exe See https://community.mcafee.com/external-link.jspa?url=https%3A%2F%2Fkc.mcafee.com%2Fresources%2Fsites%2FMCAFEE%2Fcontent%2Flive%2FPRODUCT_DOCUMENTATION%2F25000%2FPD25187%2Fen_US%2Fma_500_pg_en-us.pdf 17 | & https://kc.mcafee.com/corporate/index?page=content&id=KB84087 18 | 10.01.2017 MS: Added Script to BIS-F for McAfee 5.0 Support, thx to Jonathan Pitre 19 | 11.01.0217 MS: $reg_agent_version = move (Get-ItemProperty "$reg_agent_string").AgentVersion after Product Installation check, otherwise error in POSH Output RegKey does not exist 20 | 13.01.2017 FF: Search for maconfig.exe under x86 and x64 Program Files 21 | 01.18.2017 JP: Added the detected agent version in the log message 22 | 06.03.2017 MS: Bugfix read Variable $varCLI = ... 23 | 08.01.2017 JP: Fixed typos 24 | 15.10.2018 MS: Bugfix 58 - remove hardcoded maconfig.exe path 25 | 28.03.2019 MS: FRQ 83 - Supporting McAfee Move integration (thanks to Torsten Witsch) 26 | 14.08.2019 MS: FRQ 3 - Remove Messagebox and using default setting if GPO is not configured 27 | 15.08.2019 MS: FRQ 88 - Supporting McAfee Endpoint Security (thanks to Wing2005) 28 | 15.08.2019 MS: Added .SYNOPSIS to all functions and using recommended POSH Verbs for functions too 29 | 03.10.2019 MS: ENH 51 - ADMX Extension: select AnitVirus full scan or custom Scan arguments 30 | 23.05.2020 MS: HF 214 - McAfee MOVE Self Protection blocks the modification of the registry 31 | 01.08.2020 MS: HF 260 - Add support for 5.6.x 32 | 33 | 34 | .LINK 35 | https://eucweb.com 36 | #> 37 | 38 | Begin { 39 | $Script_Path = $MyInvocation.MyCommand.Path 40 | $Script_Dir = Split-Path -Parent $Script_Path 41 | $Script_Name = [System.IO.Path]::GetFileName($Script_Path) 42 | 43 | # Product specified 44 | $Product = "McAfee VirusScan Enterprise" 45 | $Product2 = "McAfee Agent" 46 | $reg_product_string = "$hklm_sw_x86\Network Associates\ePolicy Orchestrator\Agent" 47 | $reg_agent_string = "$hklm_sw_x86\McAfee\Agent" 48 | $Product_Path = "$ProgramFilesx86\McAfee\VirusScan Enterprise" 49 | $ServiceName1 = "McAfeeFramework" 50 | $ServiceName2 = "McShield" 51 | $ServiceName3 = "McTaskManager" 52 | $PrepApp = "maconfig.exe" 53 | 54 | #Wing2005 - added 2 new paths to check 55 | $PrepAppSearchFolder = @("${env:ProgramFiles}\McAfee\Common Framework", "${env:ProgramFiles(x86)}\McAfee\Common Framework", "${env:ProgramFiles}\McAfee\Agent", "${env:ProgramFiles(x86)}\McAfee\Agent") 56 | 57 | [array]$reg_product_name = "AgentGUID" 58 | [array]$reg_product_name += "MacAddress" 59 | [array]$reg_product_name += "ComputerName" 60 | [array]$reg_product_name += "IPAddress" 61 | [array]$reg_product_name += "LastASCTime" 62 | [array]$reg_product_name += "SequenceNumber" 63 | [array]$reg_product_name += "SubnetMask" 64 | 65 | #McAfee MOVE with installed agent 66 | $ServiceName10 = "mvagtsvc" 67 | $Product10 = "McAfee MOVE" 68 | $HKLMAgent10path1 = "$HKLM_sw_x86\Network Associates\ePolicy Orchestrator\Agent" 69 | $HKLMAgent10key1 = "AgentGUID" 70 | $HKLMAgent10path2 = "HKLM:\SYSTEM\CurrentControlSet\Services\mvagtdrv\Parameters" 71 | $HKLMAgent10key2_1 = "ServerAddress1" 72 | $HKLMAgent10key2_2 = "ServerAddress2" 73 | $HKLMAgent10key2_3 = "ODSUniqueId" 74 | 75 | ## McAfee Endpoint Security Detection 76 | $Product20 = "McAfee Endpoint Security" 77 | $Product_Path20_1 = "$env:ProgramFiles\McAfee\Endpoint Security\Endpoint Security Platform" 78 | $Product_Path20_2 = "$env:ProgramFiles\McAfee\Endpoint Security\Threat Prevention" 79 | 80 | } 81 | 82 | Process { 83 | 84 | #################################################################### 85 | ####### Functions ##### 86 | #################################################################### 87 | 88 | Function Start-DefUpdates { 89 | <# 90 | .SYNOPSIS 91 | Update McAfee AV pattern Files 92 | 93 | .DESCRIPTION 94 | Long description 95 | 96 | .PARAMETER engine 97 | Parameter description 98 | 99 | .EXAMPLE 100 | Update Pattern Files for McAfee Virus Scan Enterprise (VSE) 101 | Start-DefUpdates -engine $product 102 | 103 | .EXAMPLE 104 | Update Pattern Files for McAfee Endpoint Security (ENS) 105 | Start-DefUpdates -engine $product20 106 | 107 | .NOTES 108 | Author: Matthias Schlimm 109 | 110 | History: 111 | 15.12.2014 JP: Added automatic virus definitions updates 112 | 28.04.2019 wing2005: Added Parameter - due to change in update mchanism 113 | 18.02.2020 JK: Fixed Log output spelling 114 | 115 | #> 116 | 117 | 118 | param( 119 | [parameter(Mandatory = $true)]$engine 120 | ) 121 | Invoke-BISFService -ServiceName "$ServiceName1" -Action Start 122 | Write-BISFLog -Msg "Updating virus definitions...please wait" 123 | switch ($engine) { 124 | $Product { 125 | Start-Process -FilePath "$Product_Path\mcupdate.exe" -ArgumentList "/update /quiet" 126 | Show-BISFProgressBar -CheckProcess "mcupdate" -ActivityText "$engine is updating the virus definitions...please wait" 127 | Start-Sleep -s 3 128 | } 129 | $Product20 { 130 | #ENS 131 | Start-Process -FilePath "$Product_Path20_2\amcfg.exe" -ArgumentList "/update" 132 | Show-BISFProgressBar -CheckProcess "amcfg" -ActivityText "$engine is updating the virus definitions...please wait" 133 | Start-Sleep -s 3 134 | } 135 | } 136 | } 137 | 138 | Function Start-AVScan { 139 | <# 140 | .SYNOPSIS 141 | Starting a AV Scan on the system 142 | 143 | .DESCRIPTION 144 | before image sealing it's vendor beste practices to start a full scan 145 | to prevent performance bottlenecks and got a full scanned image 146 | 147 | .EXAMPLE 148 | Start-AVScan 149 | 150 | .NOTES 151 | Author: Matthias Schlimm 152 | 153 | History: 154 | 10.12.2014 MS: script created 155 | 14.08.2019 MS: FRQ 3 - Remove Messagebox and using default setting if GPO is not configured 156 | 03.10.2019 MS: ENH 51 - ADMX Extension: select AnitVirus full scan or custom Scan arguments 157 | 158 | #> 159 | 160 | 161 | Write-BISFLog -Msg "Check GPO Configuration" -SubMsg -Color DarkCyan 162 | $varCLI = $LIC_BISF_CLI_AV 163 | If (($varCLI -eq "YES") -or ($varCLI -eq "NO")) { 164 | Write-BISFLog -Msg "GPO Valuedata: $varCLI" 165 | } 166 | Else { 167 | Write-BISFLog -Msg "GPO not configured.. using default setting" -SubMsg -Color DarkCyan 168 | $AVScan = "YES" 169 | } 170 | If (($AVScan -eq "YES" ) -or ($varCLI -eq "YES")) { 171 | IF ($LIC_BISF_CLI_AV_VIE_CusScanArgsb -eq 1) { 172 | Write-BISFLog -Msg "Enable Custom Scan Arguments" 173 | $args = $LIC_BISF_CLI_AV_VIE_CusScanArgs 174 | } 175 | ELSE { 176 | $args = "c:\" 177 | } 178 | 179 | Write-BISFLog -Msg "Running Scan with arguments: $args" 180 | Start-Process -FilePath "$Product_Path\Scan32.exe" -ArgumentList $args 181 | If ($OSBitness -eq "32-bit") { $ScanProcess = "Scan32" } Else { $ScanProcess = "Scan64" } 182 | Show-BISFProgressBar -CheckProcess "$ScanProcess" -ActivityText "$Product is scanning the system...please wait" 183 | } 184 | Else { 185 | Write-BISFLog -Msg "No Scan will be performed" 186 | } 187 | 188 | } 189 | 190 | Function Remove-VSEData { 191 | <# 192 | .SYNOPSIS 193 | Remvoving MacAfee VirusScan Enterprise Agent Data 194 | 195 | .DESCRIPTION 196 | For Image sealing it's necassary to delete vendor recommended files, registryitems 197 | 198 | .EXAMPLE 199 | Remove-VSEData 200 | 201 | .NOTES 202 | Author: Matthias Schlimm 203 | 204 | History: 205 | 10.12.2014 MS: script created 206 | 01.08.2020 micswe: HF 260 - Add support for 5.6.x 207 | 208 | #> 209 | 210 | If ($reg_agent_version -lt "5.0") { 211 | Invoke-BISFService -ServiceName "$ServiceName1" -Action Stop 212 | Invoke-BISFService -ServiceName "$ServiceName2" -Action Stop 213 | Invoke-BISFService -ServiceName "$ServiceName3" -Action Stop 214 | ForEach ($key in $reg_product_name) { 215 | Write-BISFLog -Msg "Delete specIfied registry items in $reg_product_string..." 216 | Write-BISFLog -Msg "Delete $key" 217 | Remove-ItemProperty -Path $reg_product_string -Name $key -ErrorAction SilentlyContinue 218 | } 219 | } 220 | If (($reg_agent_version -ge "5.0") -and ($reg_agent_version -lt "5.6")) { 221 | 222 | $found = $false 223 | Write-BISFLog -Msg "Searching for $PrepApp on the system" -ShowConsole -Color DarkCyan -SubMsg 224 | 225 | # Wing2005 - FIX: -Path parameter (was with quotes) 226 | $PrepAppExists = Get-ChildItem -Path $PrepAppSearchFolder -filter "$PrepApp" -ErrorAction SilentlyContinue | % { $_.FullName } 227 | 228 | IF (($PrepAppExists -ne $null) -and ($found -ne $true)) { 229 | 230 | If (Test-Path ("$PrepAppExists") -PathType Leaf ) { 231 | Write-BISFLog -Msg "$PrepApp found in $PrepAppExists" -ShowConsole -Color DarkCyan -SubMsg 232 | Write-BISFLog -Msg "Removed $Product GUID" 233 | $found = $true 234 | & Start-Process -FilePath "$PrepAppExists" -ArgumentList "-enforce -noguid" -Wait 235 | } 236 | } 237 | } 238 | 239 | # https://docs.mcafee.com/bundle/agent-5.6.x-installation-guide/page/GUID-7264ED00-8FFC-49B8-9A21-07FF12D2EA88.html 240 | If ($reg_agent_version -ge "5.6"){ 241 | Write-BISFLog -Msg "Version $reg_agent_version - No need to remove GUID" 242 | } 243 | } 244 | 245 | Function Remove-Agent10Data { 246 | <# 247 | .SYNOPSIS 248 | Remove MCAfee Move Agent data 249 | 250 | .DESCRIPTION 251 | For Image sealing it's necassary to delete vendor recommended files, registryitems 252 | 253 | .EXAMPLE 254 | Remove-Agent10Data 255 | 256 | .NOTES 257 | Author: Matthias Schlimm 258 | 259 | History: 260 | 28.03.2019 MS: script created 261 | 23.05.2020 MS: HF 214 - McAfee MOVE Self Protection blocks the modification of the registry 262 | #> 263 | 264 | powershell -command "mvadm config set IntegrityEnabled=0" 265 | 266 | Write-BISFLog -Msg "Remove Registry $HKLMAgent10path1 - Key $HKLMAgent10key1" -ShowConsole -Color DarkCyan -SubMsg 267 | Remove-ItemProperty -Path $HKLMAgent10path1 -Name $HKLMAgent10key1 -ErrorAction SilentlyContinue 268 | 269 | Write-BISFLog -Msg "Update Registry $HKLMAgent10path2 - Key $HKLMAgent10key2_1" 270 | Set-ItemProperty -Path $HKLMAgent10path2 -Name $HKLMAgent10key2_1 -value "" -Force 271 | 272 | Write-BISFLog -Msg "Update Registry $HKLMAgent10path2 - Key $HKLMAgent10key2_2" 273 | Set-ItemProperty -Path $HKLMAgent10path2 -Name $HKLMAgent10key2_2 -value "" -Force 274 | 275 | Write-BISFLog -Msg "Update Registry $HKLMAgent10path2 - Key $HKLMAgent10key2_3" 276 | Set-ItemProperty -Path $HKLMAgent10path2 -Name $HKLMAgent10key2_3 -value "" -Force 277 | 278 | powershell -command "mvadm config set IntegrityEnabled=7" 279 | 280 | } 281 | 282 | #################################################################### 283 | ####### End functions ##### 284 | #################################################################### 285 | 286 | #### Main Program 287 | 288 | # Discovering McAfee Virus Scan Enterprise (VSE) 289 | If (Test-Path ("$Product_Path\shstat.exe") -PathType Leaf) { 290 | Write-BISFLog -Msg "Product $Product installed" -ShowConsole -Color Cyan 291 | $reg_agent_version = (Get-ItemProperty "$reg_agent_string").AgentVersion 292 | Write-BISFLog -Msg "Product $Product2 $reg_agent_version installed" -ShowConsole -Color Cyan 293 | Start-DefUpdates -engine $Product 294 | Start-AVScan 295 | Remove-VSEData 296 | } 297 | Else { 298 | Write-BISFLog -Msg "Product $Product NOT installed" 299 | } 300 | 301 | #Discovering McAfee Move 302 | $svc = Test-BISFService -ServiceName $servicename10 -ProductName "$product10" 303 | IF ($svc -eq $true) { 304 | Write-BISFLog -Msg "Information only: Unselect 'Enable Selfprotection' on the McAfee Management Server and/or in the Policy for MOVE AV Common" -ShowConsole -Color DarkCyan -SubMsg 305 | Write-BISFLog -Msg "Perform an On Demand Scan (ODS) before you run this script to build up the cache" 306 | Remove-Agent10Data 307 | } 308 | 309 | #Discovering McAfee Endpoint Security (ENS) 310 | IF (Test-Path ("$Product_Path20_1\mfeesp.exe") -PathType Leaf) { 311 | Write-BISFLog -Msg "Product $Product20 installed" -ShowConsole -Color Cyan 312 | $reg_agent_version = (Get-ItemProperty "$reg_agent_string").AgentVersion 313 | Write-BISFLog -Msg "Product $Product20 $reg_agent_version installed" -ShowConsole -Color Cyan 314 | Start-DefUpdates -engine $Product20 315 | #wing2005 - Disabled Scan From Commandline not supported yet (will be in ENS 10.7) 316 | #Start-AVScan 317 | Remove-VSEData 318 | } 319 | Else { 320 | Write-BISFLog -Msg "Product $Product20 is NOT installed" 321 | } 322 | 323 | } 324 | 325 | End { 326 | Add-BISFFinishLine 327 | } --------------------------------------------------------------------------------