Update 4.1.8/4.1.8-Command-Examples.ps1
Removed extra crap.
This commit is contained in:
@@ -1,37 +1,31 @@
|
|||||||
<#
|
<#
|
||||||
Fold Ctrl+K Ctrl+0
|
PSADT 4.1.8 Compatible Commands
|
||||||
Unfold Ctrl+K Ctrl+J
|
|
||||||
PSADT 4.1.x Compatible Commands
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
##*===============================================
|
## PRE-INSTALLATION
|
||||||
##* PRE-INSTALLATION
|
#############################################################
|
||||||
##*===============================================
|
#############################################################
|
||||||
|
|
||||||
#Region Close applications before proceeding
|
#Close applications before proceeding
|
||||||
Show-ADTInstallationWelcome -CloseProcesses 'mBlock','msedge' -BlockExecution -CloseProcessesCountdown 1800 -NotTopMost
|
Show-ADTInstallationWelcome -CloseProcesses 'mBlock','msedge' -BlockExecution -CloseProcessesCountdown 1800 -NotTopMost
|
||||||
Show-ADTInstallationWelcome -CloseProcesses 'mBlock','msedge' -BlockExecution -AllowDeferCloseProcesses -DeferTimes 5 -DeferDays 2 -ForceCloseProcessesCountdown 1800 -PersistPrompt -NotTopMost
|
Show-ADTInstallationWelcome -CloseProcesses 'mBlock','msedge' -BlockExecution -AllowDeferCloseProcesses -DeferTimes 5 -DeferDays 2 -ForceCloseProcessesCountdown 1800 -PersistPrompt -NotTopMost
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
##*===============================================
|
## INSTALLATION
|
||||||
##* INSTALLATION
|
#############################################################
|
||||||
##*===============================================
|
#############################################################
|
||||||
|
|
||||||
#Region Download content
|
#Download content
|
||||||
$ProgressPreference = 'SilentlyContinue'
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
Invoke-WebRequest -Uri "https://toronenintuneblob.blob.core.windows.net/intuneapp/file.zip" -OutFile "$($env:PUBLIC)\Desktop\file.zip"
|
Invoke-WebRequest -Uri "https://toronenintuneblob.blob.core.windows.net/intuneapp/file.zip" -OutFile "$($env:PUBLIC)\Desktop\file.zip"
|
||||||
#Endregion
|
|
||||||
|
|
||||||
#Region Expand-Archive
|
#Expand-Archive
|
||||||
Expand-Archive -LiteralPath "$($env:PUBLIC)\Desktop\file.zip" -DestinationPath "$($env:PUBLIC)\Desktop\Expanded"
|
Expand-Archive -LiteralPath "$($env:PUBLIC)\Desktop\file.zip" -DestinationPath "$($env:PUBLIC)\Desktop\Expanded"
|
||||||
Expand-Archive -Path "$($adtSession.DirFiles)\FyiFile.zip" -DestinationPath "C:\Path"
|
Expand-Archive -Path "$($adtSession.DirFiles)\FyiFile.zip" -DestinationPath "C:\Path"
|
||||||
#Endregion
|
|
||||||
|
|
||||||
#Region Unzip installation source files to a temp folder with 7-Zip standalone
|
#Unzip installation source files to a temp folder with 7-Zip standalone
|
||||||
Start-ADTProcess -FilePath "$($adtSession.DirSupportFiles)\7za.exe" -ArgumentList "x `"$($adtSession.DirFiles)\source.zip`" -o`"$envProgramFiles\SWTEMP`" -y"
|
Start-ADTProcess -FilePath "$($adtSession.DirSupportFiles)\7za.exe" -ArgumentList "x `"$($adtSession.DirFiles)\source.zip`" -o`"$envProgramFiles\SWTEMP`" -y"
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
#Region Install Microsoft 365 apps and Teams
|
#Install Microsoft 365 apps and Teams
|
||||||
If (((Get-WmiObject Win32_ComputerSystem).Model -eq "VMware Virtual Platform") -or ((Get-WmiObject Win32_ComputerSystem).Model -eq "Virtual Machine") -or ((Get-WmiObject Win32_ComputerSystem).Model -eq "VirtualBox")){
|
If (((Get-WmiObject Win32_ComputerSystem).Model -eq "VMware Virtual Platform") -or ((Get-WmiObject Win32_ComputerSystem).Model -eq "Virtual Machine") -or ((Get-WmiObject Win32_ComputerSystem).Model -eq "VirtualBox")){
|
||||||
|
|
||||||
#Optimize Teams for VDI
|
#Optimize Teams for VDI
|
||||||
@@ -53,24 +47,20 @@ Else{
|
|||||||
#Install Microsoft 365 desktop apps for single-session host
|
#Install Microsoft 365 desktop apps for single-session host
|
||||||
Start-ADTProcess -FilePath "$($adtSession.DirFiles)\setup.exe" -ArgumentList "/configure `"$($adtSession.DirFiles)\Install-singlesession.xml`"" -WindowStyle Hidden -WaitForMsiExec
|
Start-ADTProcess -FilePath "$($adtSession.DirFiles)\setup.exe" -ArgumentList "/configure `"$($adtSession.DirFiles)\Install-singlesession.xml`"" -WindowStyle Hidden -WaitForMsiExec
|
||||||
}
|
}
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
#Install Microsoft Teams
|
#Install Microsoft Teams
|
||||||
Start-ADTProcess -FilePath "teamsbootstrapper.exe" -ArgumentList "-p"
|
Start-ADTProcess -FilePath "teamsbootstrapper.exe" -ArgumentList "-p"
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
#Region Run MSI installer
|
#Run MSI installer
|
||||||
Start-ADTMsiProcess -Action "Install" -FilePath "setup.msi"
|
Start-ADTMsiProcess -Action "Install" -FilePath "setup.msi"
|
||||||
Start-ADTMsiProcess -Action "Install" -FilePath "setup.msi" -AdditionalArgumentList "AUTO_UPDATE=2","NOTINSTALLUPDATE=0"
|
Start-ADTMsiProcess -Action "Install" -FilePath "setup.msi" -AdditionalArgumentList "AUTO_UPDATE=2","NOTINSTALLUPDATE=0"
|
||||||
Start-ADTMsiProcess -Action "Install" -FilePath "setup.msi" -AdditionalArgumentList "AUTO_UPDATE=2","NOTINSTALLUPDATE=0" -ArgumentList '/qn'
|
Start-ADTMsiProcess -Action "Install" -FilePath "setup.msi" -AdditionalArgumentList "AUTO_UPDATE=2","NOTINSTALLUPDATE=0" -ArgumentList '/qn'
|
||||||
Start-ADTMsiProcess -Action "Install" -FilePath "setup.msi" -Transforms "transforms.mst" -AdditionalArgumentList "AUTO_UPDATE=2","NOTINSTALLUPDATE=0" -ArgumentList '/qn'
|
Start-ADTMsiProcess -Action "Install" -FilePath "setup.msi" -Transforms "transforms.mst" -AdditionalArgumentList "AUTO_UPDATE=2","NOTINSTALLUPDATE=0" -ArgumentList '/qn'
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
#Region Run MSP patch
|
#Run MSP patch
|
||||||
Start-ADTMspProcess -FilePath 'AcroRdr2017Upd1701130143_MUI.msp' -AdditionalArgumentList 'ALLUSERS=1'
|
Start-ADTMspProcess -FilePath 'AcroRdr2017Upd1701130143_MUI.msp' -AdditionalArgumentList 'ALLUSERS=1'
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
#Region Run EXE
|
#Run EXE
|
||||||
#Run InstallShield process and record .ISS answer file. The answer file will be created in C:\Windows folder
|
#Run InstallShield process and record .ISS answer file. The answer file will be created in C:\Windows folder
|
||||||
Start-ADTProcess -FilePath "Setup.exe" -ArgumentList "/r" -IgnoreExitCodes '*' -WindowStyle Hidden
|
Start-ADTProcess -FilePath "Setup.exe" -ArgumentList "/r" -IgnoreExitCodes '*' -WindowStyle Hidden
|
||||||
Start-Process -FilePath "$($adtSession.DirFiles)\SETUP.EXE" -ArgumentList "/r" -Wait -WindowStyle Hidden -EA 0
|
Start-Process -FilePath "$($adtSession.DirFiles)\SETUP.EXE" -ArgumentList "/r" -Wait -WindowStyle Hidden -EA 0
|
||||||
@@ -84,9 +74,8 @@ Start-Process -FilePath "$($adtSession.DirFiles)\SETUP.EXE" -ArgumentList "/s /f
|
|||||||
Start-Process -FilePath "$($adtSession.DirFiles)\CADMATIC_Draw_2024T1R2_FIN.exe" -ArgumentList "/userdata `"$($adtSession.DirFiles)\UserData.dat`" /activationkey 10395-69014-52815-95927 /DEFAULT /SILENT" -Wait -WindowStyle Hidden -EA 0
|
Start-Process -FilePath "$($adtSession.DirFiles)\CADMATIC_Draw_2024T1R2_FIN.exe" -ArgumentList "/userdata `"$($adtSession.DirFiles)\UserData.dat`" /activationkey 10395-69014-52815-95927 /DEFAULT /SILENT" -Wait -WindowStyle Hidden -EA 0
|
||||||
Start-ADTProcess -FilePath "Setup.exe" -ArgumentList "/r" -IgnoreExitCodes '*' -WindowStyle Hidden
|
Start-ADTProcess -FilePath "Setup.exe" -ArgumentList "/r" -IgnoreExitCodes '*' -WindowStyle Hidden
|
||||||
|
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
#Region Run Appx installers
|
#Run Appx installers
|
||||||
#User account
|
#User account
|
||||||
Add-AppxPackage -Path "$($adtSession.DirFiles)\MicrosoftCorporationII.Windows365_1.3.241.0_x64__8wekyb3d8bbwe.Msix" -DependencyPath "$($adtSession.DirFiles)\Microsoft.VCLibs.140.00_14.0.33519.0_x64__8wekyb3d8bbwe.Appx","$($adtSession.DirFiles)\Microsoft.VCLibs.140.00.UWPDesktop_14.0.33519.0_x64__8wekyb3d8bbwe.Appx"
|
Add-AppxPackage -Path "$($adtSession.DirFiles)\MicrosoftCorporationII.Windows365_1.3.241.0_x64__8wekyb3d8bbwe.Msix" -DependencyPath "$($adtSession.DirFiles)\Microsoft.VCLibs.140.00_14.0.33519.0_x64__8wekyb3d8bbwe.Appx","$($adtSession.DirFiles)\Microsoft.VCLibs.140.00.UWPDesktop_14.0.33519.0_x64__8wekyb3d8bbwe.Appx"
|
||||||
|
|
||||||
@@ -101,27 +90,23 @@ $TestAppx = Get-AppxProvisionedPackage -Online | Where-Object {$_.DisplayName -e
|
|||||||
if(!($TestAppx)){
|
if(!($TestAppx)){
|
||||||
Add-AppxProvisionedPackage -Online -PackagePath "$($adtSession.DirFiles)\MicrosoftCorporationII.Windows365_1.3.241.0_x64__8wekyb3d8bbwe.Msix" -SkipLicense
|
Add-AppxProvisionedPackage -Online -PackagePath "$($adtSession.DirFiles)\MicrosoftCorporationII.Windows365_1.3.241.0_x64__8wekyb3d8bbwe.Msix" -SkipLicense
|
||||||
}
|
}
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
#Region Run PowerShell script
|
#Run PowerShell script
|
||||||
Start-ADTProcess -FilePath "powershell.exe" -ArgumentList "-Command & { & `"$($adtSession.DirFiles)\ConfigureSEMM.ps1`"; Exit `$LastExitCode }"
|
Start-ADTProcess -FilePath "powershell.exe" -ArgumentList "-Command & { & `"$($adtSession.DirFiles)\ConfigureSEMM.ps1`"; Exit `$LastExitCode }"
|
||||||
#Endregion
|
|
||||||
|
|
||||||
#Region Execute process as logged in user
|
#Execute process as logged in user
|
||||||
Start-ADTProcessAsUser -FilePath "$PSHOME\powershell.exe" -ArgumentList "-Command & { & `"C:\Test\Script.ps1`"; Exit `$LastExitCode }"
|
Start-ADTProcessAsUser -FilePath "$PSHOME\powershell.exe" -ArgumentList "-Command & { & `"C:\Test\Script.ps1`"; Exit `$LastExitCode }"
|
||||||
Start-ADTProcessAsUser -FilePath "$envProgramFiles\Microsoft OneDrive\OneDrive.exe" -ArgumentList "/background"
|
Start-ADTProcessAsUser -FilePath "$envProgramFiles\Microsoft OneDrive\OneDrive.exe" -ArgumentList "/background"
|
||||||
Start-ADTProcessAsUser -FilePath "$envProgramFiles\DesktopInfo\DesktopInfo64.exe"
|
Start-ADTProcessAsUser -FilePath "$envProgramFiles\DesktopInfo\DesktopInfo64.exe"
|
||||||
#Endregion
|
|
||||||
|
|
||||||
#Region Wait until process has closed
|
#Wait until process has closed
|
||||||
#Process name in this example is "setup"
|
#Process name in this example is "setup"
|
||||||
do{
|
do{
|
||||||
Start-Sleep -Seconds 3
|
Start-Sleep -Seconds 3
|
||||||
}
|
}
|
||||||
until (!(Get-Process setup -EA 0))
|
until (!(Get-Process setup -EA 0))
|
||||||
#Endregion
|
|
||||||
|
|
||||||
#Region Modify files and folders
|
#Modify files and folders
|
||||||
#Create folder
|
#Create folder
|
||||||
New-ADTFolder -Path "C:\Windows\STWindowsRestart"
|
New-ADTFolder -Path "C:\Windows\STWindowsRestart"
|
||||||
|
|
||||||
@@ -138,22 +123,19 @@ Copy-ADTFile -Path "$($adtSession.DirFiles)\*" -Destination "C:\Windows\STWindow
|
|||||||
|
|
||||||
#Remove file
|
#Remove file
|
||||||
Remove-ADTFile -Path 'C:\eula.1028.txt'
|
Remove-ADTFile -Path 'C:\eula.1028.txt'
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
#Region Add new lines to text file
|
#Add new lines to text file
|
||||||
Add-Content -Path "C:\ProgramData\CADMATIC\Draw 24\CadsSetup.ini" -Value "CadsnetHost=uksrv2" -Force
|
Add-Content -Path "C:\ProgramData\CADMATIC\Draw 24\CadsSetup.ini" -Value "CadsnetHost=uksrv2" -Force
|
||||||
Add-Content -Path "C:\ProgramData\CADMATIC\Draw 24\CadsSetup.ini" -Value "[Automaattipäivitys]" -Force
|
Add-Content -Path "C:\ProgramData\CADMATIC\Draw 24\CadsSetup.ini" -Value "[Automaattipäivitys]" -Force
|
||||||
Add-Content -Path "C:\ProgramData\CADMATIC\Draw 24\CadsSetup.ini" -Value "Estetty=1333" -Force
|
Add-Content -Path "C:\ProgramData\CADMATIC\Draw 24\CadsSetup.ini" -Value "Estetty=1333" -Force
|
||||||
#Endregion
|
|
||||||
|
|
||||||
#Region add content to hosts file
|
#add content to hosts file
|
||||||
$File = "C:\Windows\System32\drivers\etc\hosts"
|
$File = "C:\Windows\System32\drivers\etc\hosts"
|
||||||
$Hostfile = Get-Content $File
|
$Hostfile = Get-Content $File
|
||||||
$Hostfile += "10.0.12.87 sopronet.fyi.fi campus.fyi.fi study.fyi.fi"
|
$Hostfile += "10.0.12.87 sopronet.fyi.fi campus.fyi.fi study.fyi.fi"
|
||||||
Set-Content -Path $File -Value $Hostfile -Force
|
Set-Content -Path $File -Value $Hostfile -Force
|
||||||
#Endregion
|
|
||||||
|
|
||||||
#Region Certificates
|
#Certificates
|
||||||
<#
|
<#
|
||||||
Certificate stores:
|
Certificate stores:
|
||||||
Root "Trusted Root Certification Authorities"
|
Root "Trusted Root Certification Authorities"
|
||||||
@@ -198,18 +180,15 @@ Import-PfxCertificate "$($adtSession.DirFiles)\MSIX.pfx" "LocalMachine" "Trusted
|
|||||||
|
|
||||||
#Remove Certificates
|
#Remove Certificates
|
||||||
Start-ADTProcess -FilePath "certutil.exe" -ArgumentList "-f -delstore -enterprise Root `"edcdb4651c35feba0c0912b14c449112dbb9e8bc`""
|
Start-ADTProcess -FilePath "certutil.exe" -ArgumentList "-f -delstore -enterprise Root `"edcdb4651c35feba0c0912b14c449112dbb9e8bc`""
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
#Region Modify DLL modules
|
#Modify DLL modules
|
||||||
Register-ADTDll -FilePath "$($adtSession.DirFiles)\example\codec.dll"
|
Register-ADTDll -FilePath "$($adtSession.DirFiles)\example\codec.dll"
|
||||||
Unregister-ADTDll -FilePath "$envProgramFilesX86\Vendor\App\Temeletry.dll"
|
Unregister-ADTDll -FilePath "$envProgramFilesX86\Vendor\App\Temeletry.dll"
|
||||||
#Endregion
|
|
||||||
|
|
||||||
#Region Install INF drivers
|
#Install INF drivers
|
||||||
Get-ChildItem "$($adtSession.DirFiles)" -Recurse -Filter "*inf" | ForEach-Object { PNPUtil.exe /add-driver $_.FullName /install }
|
Get-ChildItem "$($adtSession.DirFiles)" -Recurse -Filter "*inf" | ForEach-Object { PNPUtil.exe /add-driver $_.FullName /install }
|
||||||
#Endregion
|
|
||||||
|
|
||||||
#Region Modify file or folder ACL
|
#Modify file or folder ACL
|
||||||
#Modify ACL on a file
|
#Modify ACL on a file
|
||||||
#first load the ACL
|
#first load the ACL
|
||||||
$acl_to_modify = "$envProgramData\Example\File.txt"
|
$acl_to_modify = "$envProgramData\Example\File.txt"
|
||||||
@@ -226,22 +205,19 @@ $acl = Get-Acl "$folder_to_change"
|
|||||||
$ar = New-Object System.Security.AccessControl.FileSystemAccessRule("BUILTIN\Users", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
|
$ar = New-Object System.Security.AccessControl.FileSystemAccessRule("BUILTIN\Users", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
|
||||||
$acl.SetAccessRule($ar)
|
$acl.SetAccessRule($ar)
|
||||||
Set-Acl "$folder_to_change" $acl
|
Set-Acl "$folder_to_change" $acl
|
||||||
#Endregion
|
|
||||||
|
|
||||||
#Region Set registry permissions
|
#Set registry permissions
|
||||||
Start-ADTProcess -FilePath "$($adtSession.DirSupportFiles)\SetACL.exe" -ArgumentList '-on "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" -ot reg -actn setowner -ownr "n:SYSTEM"' -WindowStyle 'Hidden'
|
Start-ADTProcess -FilePath "$($adtSession.DirSupportFiles)\SetACL.exe" -ArgumentList '-on "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" -ot reg -actn setowner -ownr "n:SYSTEM"' -WindowStyle 'Hidden'
|
||||||
Start-ADTProcess -FilePath "$($adtSession.DirSupportFiles)\SetACL.exe" -ArgumentList '-on "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" -ot reg -actn ace -ace "n:SYSTEM;p:full"' -WindowStyle 'Hidden'
|
Start-ADTProcess -FilePath "$($adtSession.DirSupportFiles)\SetACL.exe" -ArgumentList '-on "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" -ot reg -actn ace -ace "n:SYSTEM;p:full"' -WindowStyle 'Hidden'
|
||||||
#Endregion
|
|
||||||
|
|
||||||
#Region Modify registry keys for local machine
|
#Modify registry keys for local machine
|
||||||
Set-ADTRegistryKey -Key "HKLM:\SOFTWARE\Policies\Google\Chrome" -Name 'ShowHomeButton' -Type 'Dword' -Value '1'
|
Set-ADTRegistryKey -Key "HKLM:\SOFTWARE\Policies\Google\Chrome" -Name 'ShowHomeButton' -Type 'Dword' -Value '1'
|
||||||
|
|
||||||
#Remove registry keys or values for local machine
|
#Remove registry keys or values for local machine
|
||||||
Remove-ADTRegistryKey -Key "HKLM:\SOFTWARE\Policies\Google\Chrome" -Recurse
|
Remove-ADTRegistryKey -Key "HKLM:\SOFTWARE\Policies\Google\Chrome" -Recurse
|
||||||
Remove-ADTRegistryKey -Key "HKLM:\SOFTWARE\Policies\Google\Chrome" -Name 'ShowHomeButton'
|
Remove-ADTRegistryKey -Key "HKLM:\SOFTWARE\Policies\Google\Chrome" -Name 'ShowHomeButton'
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
#Region Modify registry keys for all users
|
#Modify registry keys for all users
|
||||||
#Set registry keys for all users
|
#Set registry keys for all users
|
||||||
[scriptblock]$HKCURegistrySettingsInstall = {
|
[scriptblock]$HKCURegistrySettingsInstall = {
|
||||||
Set-ADTRegistryKey -Key 'HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'Hidden' -Value 1 -Type DWord -SID $UserProfile.SID
|
Set-ADTRegistryKey -Key 'HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'Hidden' -Value 1 -Type DWord -SID $UserProfile.SID
|
||||||
@@ -255,30 +231,26 @@ Invoke-ADTAllUsersRegistryAction -ScriptBlock $HKCURegistrySettingsInstall
|
|||||||
Remove-ADTRegistryKey -Key 'HKCU\SOFTWARE\Policies\Google\Chrome' -Recurse -SID $UserProfile.SID
|
Remove-ADTRegistryKey -Key 'HKCU\SOFTWARE\Policies\Google\Chrome' -Recurse -SID $UserProfile.SID
|
||||||
}
|
}
|
||||||
Invoke-ADTAllUsersRegistryAction -ScriptBlock $HKCURegistrySettingsUninstall
|
Invoke-ADTAllUsersRegistryAction -ScriptBlock $HKCURegistrySettingsUninstall
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
#Region Clear Teams cache for logged on user
|
#Clear Teams cache for logged on user
|
||||||
$loggedonUser = Get-ADTLoggedOnUser | Select-Object -ExpandProperty UserName
|
$loggedonUser = Get-ADTLoggedOnUser | Select-Object -ExpandProperty UserName
|
||||||
$TeamsPath = [System.IO.Path]::Combine('C:\Users\', $loggedonUser,'Appdata', 'Roaming', 'Microsoft', 'Teams')
|
$TeamsPath = [System.IO.Path]::Combine('C:\Users\', $loggedonUser,'Appdata', 'Roaming', 'Microsoft', 'Teams')
|
||||||
Remove-ADTFile -Path "$TeamsPath\Cache\*"
|
Remove-ADTFile -Path "$TeamsPath\Cache\*"
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
#Region Set lock screen wallpaper
|
#Set lock screen wallpaper
|
||||||
Copy-ADTFile -Path "$($adtSession.DirFiles)\Strategiakuva_Lukitusnaytto_4K.jpg" -Destination "C:\Windows\Strategiakuva_Lukitusnaytto_4K.jpg"
|
Copy-ADTFile -Path "$($adtSession.DirFiles)\Strategiakuva_Lukitusnaytto_4K.jpg" -Destination "C:\Windows\Strategiakuva_Lukitusnaytto_4K.jpg"
|
||||||
Set-ADTRegistryKey -Key "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP" -Name "LockScreenImagePath" -Value "C:\Windows\Strategiakuva_Lukitusnaytto_4K.jpg" -Type String
|
Set-ADTRegistryKey -Key "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP" -Name "LockScreenImagePath" -Value "C:\Windows\Strategiakuva_Lukitusnaytto_4K.jpg" -Type String
|
||||||
Set-ADTRegistryKey -Key "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP" -Name "LockScreenImageStatus" -Value 1 -Type DWORD
|
Set-ADTRegistryKey -Key "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP" -Name "LockScreenImageStatus" -Value 1 -Type DWORD
|
||||||
Set-ADTRegistryKey -Key "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP" -Name "LockScreenImageUrl" -Value "C:\Windows\Strategiakuva_Lukitusnaytto_4K.jpg" -Type String
|
Set-ADTRegistryKey -Key "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP" -Name "LockScreenImageUrl" -Value "C:\Windows\Strategiakuva_Lukitusnaytto_4K.jpg" -Type String
|
||||||
RUNDLL32.EXE USER32.DLL, UpdatePerUserSystemParameters 1, True
|
RUNDLL32.EXE USER32.DLL, UpdatePerUserSystemParameters 1, True
|
||||||
#Endregion
|
|
||||||
|
|
||||||
#Region Enable Windows features
|
#Enable Windows features
|
||||||
$HyperVActive = Get-WindowsOptionalFeature -Online -FeatureName *Hyper-V-All*
|
$HyperVActive = Get-WindowsOptionalFeature -Online -FeatureName *Hyper-V-All*
|
||||||
if($HyperVActive.State -ne "Enabled"){
|
if($HyperVActive.State -ne "Enabled"){
|
||||||
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart
|
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart
|
||||||
}
|
}
|
||||||
#Endregion
|
|
||||||
|
|
||||||
#Region Inject drivers to WinRE
|
#Inject drivers to WinRE
|
||||||
$MountDir = "$env:SystemDrive\WinRE"
|
$MountDir = "$env:SystemDrive\WinRE"
|
||||||
|
|
||||||
if (!(Test-Path -Path $MountDir)) {
|
if (!(Test-Path -Path $MountDir)) {
|
||||||
@@ -291,9 +263,8 @@ dism /Image:$MountDir /Cleanup-Image /StartComponentCleanup
|
|||||||
ReAgentc.exe /unmountre /path $MountDir /commit
|
ReAgentc.exe /unmountre /path $MountDir /commit
|
||||||
|
|
||||||
Remove-Item -Path $MountDir
|
Remove-Item -Path $MountDir
|
||||||
#Endregion
|
|
||||||
|
|
||||||
#Region Set firewall rules
|
#Set firewall rules
|
||||||
#Allow through Firewall - allow private, domain but block public
|
#Allow through Firewall - allow private, domain but block public
|
||||||
if (Get-NetFirewallRule -DisplayName "Allow $($adtSession.AppName)"){
|
if (Get-NetFirewallRule -DisplayName "Allow $($adtSession.AppName)"){
|
||||||
Remove-NetFirewallRule -DisplayName "Allow $($adtSession.AppName)"
|
Remove-NetFirewallRule -DisplayName "Allow $($adtSession.AppName)"
|
||||||
@@ -306,9 +277,8 @@ New-NetFirewallRule -DisplayName "Allow $($adtSession.AppName)" -Direction Inbou
|
|||||||
New-NetFirewallRule -DisplayName "Allow $($adtSession.AppName)" -Direction Inbound -Program "$envProgramFiles\Makeblock\mBlock\mBlock.exe" -LocalPort Any -Protocol UDP -Action Allow -Enabled True -Profile Domain,Private
|
New-NetFirewallRule -DisplayName "Allow $($adtSession.AppName)" -Direction Inbound -Program "$envProgramFiles\Makeblock\mBlock\mBlock.exe" -LocalPort Any -Protocol UDP -Action Allow -Enabled True -Profile Domain,Private
|
||||||
New-NetFirewallRule -DisplayName "Block $($adtSession.AppName)" -Direction Inbound -Program "$envProgramFiles\Makeblock\mBlock\mBlock.exe" -LocalPort Any -Protocol TCP -Action Block -Enabled True -Profile Public
|
New-NetFirewallRule -DisplayName "Block $($adtSession.AppName)" -Direction Inbound -Program "$envProgramFiles\Makeblock\mBlock\mBlock.exe" -LocalPort Any -Protocol TCP -Action Block -Enabled True -Profile Public
|
||||||
New-NetFirewallRule -DisplayName "Block $($adtSession.AppName)" -Direction Inbound -Program "$envProgramFiles\Makeblock\mBlock\mBlock.exe" -LocalPort Any -Protocol UDP -Action Block -Enabled True -Profile Public
|
New-NetFirewallRule -DisplayName "Block $($adtSession.AppName)" -Direction Inbound -Program "$envProgramFiles\Makeblock\mBlock\mBlock.exe" -LocalPort Any -Protocol UDP -Action Block -Enabled True -Profile Public
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
#Region Create and remove public desktop shortcuts
|
#Create and remove public desktop shortcuts
|
||||||
if(!(Test-Path "C:\Users\Public\Desktop\PowerShell.lnk" -PathType Leaf)){
|
if(!(Test-Path "C:\Users\Public\Desktop\PowerShell.lnk" -PathType Leaf)){
|
||||||
$WScriptObj = New-Object -ComObject ("WScript.Shell")
|
$WScriptObj = New-Object -ComObject ("WScript.Shell")
|
||||||
$shortcut = $WscriptObj.CreateShortcut("C:\Users\Public\Desktop\PowerShell.lnk")
|
$shortcut = $WscriptObj.CreateShortcut("C:\Users\Public\Desktop\PowerShell.lnk")
|
||||||
@@ -319,9 +289,8 @@ if(!(Test-Path "C:\Users\Public\Desktop\PowerShell.lnk" -PathType Leaf)){
|
|||||||
|
|
||||||
#Remove public desktop shortcut
|
#Remove public desktop shortcut
|
||||||
Remove-ADTFile -Path "$envCommonDesktop\mBlock.lnk"
|
Remove-ADTFile -Path "$envCommonDesktop\mBlock.lnk"
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
#Region Add M-Files vault
|
#Add M-Files vault
|
||||||
# M-Files Vault 1
|
# M-Files Vault 1
|
||||||
If (Test-Path "$env:ProgramFiles\M-Files\*\Bin\x64\MFStatus.exe"){
|
If (Test-Path "$env:ProgramFiles\M-Files\*\Bin\x64\MFStatus.exe"){
|
||||||
$Versio = Resolve-Path "$env:ProgramFiles\M-Files\*\Bin\x64\MFStatus.exe" | Select-Object -ExpandProperty Path
|
$Versio = Resolve-Path "$env:ProgramFiles\M-Files\*\Bin\x64\MFStatus.exe" | Select-Object -ExpandProperty Path
|
||||||
@@ -356,39 +325,32 @@ Else{
|
|||||||
Set-ADTRegistryKey -Key "HKLM:\SOFTWARE\Motive\M-Files\$($adtSession.AppVersion)\Client\MFClient\Vaults\Company" -Name 'SPN' -Value "" -Type String
|
Set-ADTRegistryKey -Key "HKLM:\SOFTWARE\Motive\M-Files\$($adtSession.AppVersion)\Client\MFClient\Vaults\Company" -Name 'SPN' -Value "" -Type String
|
||||||
#Set-ADTRegistryKey -Key "HKLM:\SOFTWARE\Motive\$($adtSession.AppVersion)\Client\MFClient" -Name 'ApproveEachApplicationSeparately' -Value "0" -Type Dword
|
#Set-ADTRegistryKey -Key "HKLM:\SOFTWARE\Motive\$($adtSession.AppVersion)\Client\MFClient" -Name 'ApproveEachApplicationSeparately' -Value "0" -Type Dword
|
||||||
}
|
}
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
##*===============================================
|
## POST-INSTALLATION
|
||||||
##* POST-INSTALLATION
|
#############################################################
|
||||||
##*===============================================
|
#############################################################
|
||||||
|
|
||||||
#Region Set registry value after successful installation
|
#Set registry value after successful installation
|
||||||
Set-ADTRegistryKey -Key "HKLM:\SOFTWARE\$($adtSession.AppScriptAuthor)\$($adtSession.AppVendor)\$($adtSession.AppName)\$($adtSession.AppVersion)" -Name 'Installed' -Type 'String' -Value '1'
|
Set-ADTRegistryKey -Key "HKLM:\SOFTWARE\$($adtSession.AppScriptAuthor)\$($adtSession.AppVendor)\$($adtSession.AppName)\$($adtSession.AppVersion)" -Name 'Installed' -Type 'String' -Value '1'
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
#Region Force restart after installation
|
#Force restart after installation
|
||||||
Show-ADTInstallationRestartPrompt -Countdownseconds 120 -CountdownNoHideSeconds 60
|
Show-ADTInstallationRestartPrompt -Countdownseconds 120 -CountdownNoHideSeconds 60
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
##*===============================================
|
## PRE-UNINSTALLATION
|
||||||
##* PRE-UNINSTALLATION
|
#############################################################
|
||||||
##*===============================================
|
#############################################################
|
||||||
|
|
||||||
#Region Close applications before proceeding
|
#Close applications before proceeding
|
||||||
Show-ADTInstallationWelcome -CloseProcesses 'mBlock','msedge' -BlockExecution -CloseProcessesCountdown 1800 -NotTopMost
|
Show-ADTInstallationWelcome -CloseProcesses 'mBlock','msedge' -BlockExecution -CloseProcessesCountdown 1800 -NotTopMost
|
||||||
#Endregion
|
|
||||||
|
|
||||||
##*===============================================
|
## UNINSTALLATION
|
||||||
##* UNINSTALLATION
|
#############################################################
|
||||||
##*===============================================
|
#############################################################
|
||||||
|
|
||||||
## <Perform Uninstallation tasks here>
|
#Remove MSI application
|
||||||
|
|
||||||
#Region Remove MSI application
|
|
||||||
Uninstall-ADTApplication -Name 'mBlock'
|
Uninstall-ADTApplication -Name 'mBlock'
|
||||||
#Endregion
|
|
||||||
|
|
||||||
#Region Run Appx uninstaller
|
#Run Appx uninstaller
|
||||||
#User account 1
|
#User account 1
|
||||||
Remove-AppxPackage package1_1.0.0.0_neutral__8wekyb3d8bbwe #PackageName
|
Remove-AppxPackage package1_1.0.0.0_neutral__8wekyb3d8bbwe #PackageName
|
||||||
|
|
||||||
@@ -402,31 +364,24 @@ $AppPackageName = "MicrosoftCorporationII.Windows365"
|
|||||||
$PackageName = Get-AppxProvisionedPackage -Online | Where-Object {$_.DisplayName -eq $AppPackageName}
|
$PackageName = Get-AppxProvisionedPackage -Online | Where-Object {$_.DisplayName -eq $AppPackageName}
|
||||||
$PackageName.PackageName
|
$PackageName.PackageName
|
||||||
Remove-AppxProvisionedPackage -PackageName $PackageName.PackageName -AllUsers -Online
|
Remove-AppxProvisionedPackage -PackageName $PackageName.PackageName -AllUsers -Online
|
||||||
#EndRegion
|
|
||||||
|
|
||||||
#Region Remove Trusted Publisher Certificate
|
#Remove Trusted Publisher Certificate
|
||||||
Start-ADTProcess -FilePath "certutil.exe" -ArgumentList "-f -delstore -enterprise TrustedPublisher `"0a8b99555bf112ee6166825f03cbc3ed`""
|
Start-ADTProcess -FilePath "certutil.exe" -ArgumentList "-f -delstore -enterprise TrustedPublisher `"0a8b99555bf112ee6166825f03cbc3ed`""
|
||||||
#Endregion
|
|
||||||
|
|
||||||
#Region Remove Firewall rule
|
#Remove Firewall rule
|
||||||
if (Get-NetFirewallRule -DisplayName "Allow $($adtSession.AppName)"){
|
if (Get-NetFirewallRule -DisplayName "Allow $($adtSession.AppName)"){
|
||||||
Remove-NetFirewallRule -DisplayName "Allow $($adtSession.AppName)"
|
Remove-NetFirewallRule -DisplayName "Allow $($adtSession.AppName)"
|
||||||
}
|
}
|
||||||
if (Get-NetFirewallRule -DisplayName "Block $($adtSession.AppName)"){
|
if (Get-NetFirewallRule -DisplayName "Block $($adtSession.AppName)"){
|
||||||
Remove-NetFirewallRule -DisplayName "Block $($adtSession.AppName)"
|
Remove-NetFirewallRule -DisplayName "Block $($adtSession.AppName)"
|
||||||
}
|
}
|
||||||
#Endregion
|
|
||||||
|
|
||||||
#Region Delete desktop shortcut
|
#Delete desktop shortcut
|
||||||
Remove-ADTFile -Path "$envCommonDesktop\mBlock.lnk" -EA 0
|
Remove-ADTFile -Path "$envCommonDesktop\mBlock.lnk" -EA 0
|
||||||
#Endregion
|
|
||||||
|
|
||||||
##*===============================================
|
## POST-UNINSTALLATION
|
||||||
##* POST-UNINSTALLATION
|
#############################################################
|
||||||
##*===============================================
|
#############################################################
|
||||||
|
|
||||||
## <Perform Post-Uninstallation tasks here>
|
#Remove registry value after successful uninstallation
|
||||||
|
Remove-ADTRegistryKey -Key "HKLM:\SOFTWARE\$($adtSession.AppScriptAuthor)\$($adtSession.AppVendor)\$($adtSession.AppName)" -Recurse
|
||||||
#Region Remove registry value after successful uninstallation
|
|
||||||
Remove-ADTRegistryKey -Key "HKLM:\SOFTWARE\$($adtSession.AppScriptAuthor)\$($adtSession.AppVendor)\$($adtSession.AppName)" -Recurse
|
|
||||||
#EndRegion
|
|
||||||
Reference in New Issue
Block a user