Pages

Tuesday, 3 March 2020

All Scripts for Packaging

$registryPath = "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Adobe\Adobe Reader\DC\FeatureLockDown"
$Name = bSuppressSignOut
$Value = 00000001
New-ItemProperty -Path $registryPath -Name $bSuppressSignOut -Value 00000001 -PropertyType DWORD -Force | Null

#------------------------------------------------------------------------------------------------------------------

#forceAccountLogonPictureFromAD:
[CmdletBinding(SupportsShouldProcess=$true)]Param()
function Test-Null($InputObject) { return !([bool]$InputObject) }

#get sid and photo for current user
$user = ([ADSISearcher]"(&(objectCategory=User)(SAMAccountName=$env:username))").FindOne().Properties
$user_photo = $user.thumbnailphoto
$user_sid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value
Write-Verbose "Updating account picture for $($user.displayname)..."

#continue if an image was returned
If ((Test-Null $user_photo) -eq $false)
{
Write-Verbose "Success. Photo exists in Active Directory."

#set up image sizes and base path
#$image_sizes = @(40, 96, 200, 240, 448) #Default Image sizes
$image_sizes = @(32, 40, 48, 96, 192, 200, 240, 448) #These extra were found in my registry
$image_mask = "Image{0}.jpg"
$image_base = $env:public + "\AccountPictures"

#set up registry
$reg_base = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users\{0}"
$reg_key = [string]::format($reg_base, $user_sid)
$reg_value_mask = "Image{0}"
If ((Test-Path -Path $reg_key) -eq $false) { New-Item -Path $reg_key }

#save images, set reg keys
ForEach ($size in $image_sizes)
{
#create hidden directory, if it doesn't exist
$dir = $image_base + "\" + $user_sid
If ((Test-Path -Path $dir) -eq $false) { $(mkdir $dir).Attributes = "Hidden" }

#save photo to disk, overwrite existing files
$file_name = ([string]::format($image_mask, $size))
$path = $dir + "\" + $file_name
Write-Verbose "  saving: $file_name"
$user_photo | Set-Content -Path $path -Encoding Byte -Force

#save the path in registry, overwrite existing entries
$name = [string]::format($reg_value_mask, $size)
$value = New-ItemProperty -Path $reg_key -Name $name -Value $path -Force
}

Write-Verbose "Done."
} else { Write-Error "No photo found in Active Directory for $env:username" }



#------------------------------------------------------------------------------------------------------------------------------

Execute-MSI -Action 'Install' -path "$Dirfiles\VCRT_x64\vc_runtimeMinimum_x64.msi" -parameters "/qn" -ContinueOnError:$True

Execute-MSI -Action 'Install' -path "$Dirfiles\AcroPro.msi" -Transform 'Acrobat17.mst' -parameters "/qn"

Execute-MSI -Action 'Patch' -path "$dirfiles\Acrobat2017Upd1701130096.msp"


#---------------------------------------------------------------------------------------------------------------------------------

Show-InstallationProgress -StatusMessage "Installing Adobe AIR 29.0 . . .`nInstallation may take 5 minutes to complete."


#__________________________________________________________________________________________________________________________________

Execute-process -path "taskkill.exe" -Parameters "/F /IM Bentley.Connect.Client.exe"

$RegKey = “HKLM:\SOFTWARE\Policies\Adobe\AIR”
if (-Not(Test-Path $RegKey)) {
New-Item -Path $($RegKey.TrimEnd($RegKey.Split(‘\’)[-1])) -Name $($RegKey.Split(‘\’)[-1]) -Force | Out-Null
}
Set-ItemProperty -Path $RegKey -Name “UpdateDisabled” -Type Dword -Value “1”

New-Folder -Path "c:\Users\$env:username\AppData\Adobe\AIR"    

Copy-Item -Path "$dirSupportFiles\UpdateDisabled.txt" -Destination "c:\Users\$env:username\AppData\Adobe\AIR"

Rename-Item "c:\Users\$env:username\AppData\Adobe\AIR\UpdateDisabled.txt" "c:\Users\$env:username\AppData\Adobe\AIR\UpdateDisabled"

<#---------------------------------------------------------------------------------------------------------------------------------------
StopOfficeandIE.vbs  

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'iexplore.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'outlook.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'winword.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'excel.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'POWERPNT.EXE'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'MSOFFICE.EXE'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'MSAccess.EXE'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Notepad.EXE'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Wordpad.EXE'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'AcroRD32.EXE'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Acrobat.EXE'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'communicator.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next


#>#---------------------------------------------------------------------------------------------------------------------

Execute-Process -path 'vc_redist.x86.exe' -Parameters '/install /quiet /norestart' -IgnoreExitCodes '1638'
Execute-MSI -Action 'Install' -Path 'AGI32-19.5.msi' -Transform 'LightingAnalysts_AGI32_19.5.mst' -Parameters '/QN'
Execute-MSI -Action 'Uninstall' -Path '{812C00AF-8A83-477B-9789-8FB80FC1925E}'

#-------------------------------------------------------------------------------------------------------------------------

Execute-Process -Path "$dirFiles\AlphaCallisto.exe" -Parameters "/S -f1$Dirfiles\Install.iss"

Execute-Process -Path 'setup.exe' -Parameters '/S /f1"$Dirfiles\setup.iss"' -WindowStyle 'Hidden'


#Give Permissions to particular folder through PowerShell :


    $Alpha = "$envProgramFilesX86\Adaptive\AlphaCallisto"
    $Acl = Get-ACL $Alpha
    $AccessRule= New-Object System.Security.AccessControl.FileSystemAccessRule("Users","FullControl","ContainerInherit,Objectinherit","none","Allow")
    $Acl.AddAccessRule($AccessRule)
    Set-Acl $Alpha $Acl
    Write-log " Setting folder permissions for install directory"
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


New-Folder -path '$envprogramfilesx86\HTRI'
Execute-process -path 'C:\windows\system32\icacls.exe' -parameters '"C:\Program Files (x86)\HTRI" /grant users:(OI)(CI)F /T'


#------------------------------------------------------------------------------------------------------------------------------------------------------------

Set-RegistryKey -Key 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -Name 'FLEXLM_TIMEOUT' -Type 'String' -Value '1000000'

$regkeypath = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine"
 $value1 = ((Get-ItemProperty $regkeypath).'Site-Name')
 If ($value1 -like '*NA*') {
    Write-log "Configuring US License"
     Set-RegistryKey -Key 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -Name 'ARCGIS_LICENSE_FILE' -Type 'String' -Value '27004@HOULICS336'

     Set-RegistryKey -Key 'HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ESRI\License10.6' -Name 'LICENSE_SERVER' -Type 'String' -Value '27004@HOULICS336'
   } Else {Write-Host "NOT USA License"
 }
If ($value1 -like '*UK*') {
    Write-log "Configuring UK License"
     Set-RegistryKey -Key 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -Name 'ARCGIS_LICENSE_FILE' -Type 'String' -Value '27004@LONLICV304;27004@HOULICS336'

      Set-RegistryKey -Key 'HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ESRI\License10.6' -Name 'LICENSE_SERVER' -Type 'String' -Value '27004@LONLICV304;27004@HOULICS336'
   } Else {
 Write-Host "NOT UK License"
 }


#---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Execute-Process -Path 'ARCHIBUS_SmartClientOnly23.2R02.404_Installer-004.exe' -Parameters '/S /v/qn'
Execute-process "Regedit.exe /s $dirSupportFiles\Office_Russia.reg"

<#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

@Echo on
REGEDIT /S "%~dp0Userdata.REG"

FOR /F "usebackq tokens=2,* skip=2" %%L IN (
`reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine" /v Site-Name`
) DO SET LOCNAME=%%M
if %LOCNAME% equ NA-Houston (
REGEDIT /S "%~dp0KBR-Houston.REG"
)
if %LOCNAME% equ AP-Jakarta (
REGEDIT /S "%~dp0KBR-Jakarta.REG"
)
New-Item "$envProgramData\RAM concept" -type directory
Set-RegistryKey -Key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\RAM concept" -Name "StubPath" -Value "$envProgramData\RAM concept\licenseReg\license.bat" -Type String
Set-RegistryKey -Key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\RAM concept" -Name "Version" -Value "1,0" -Type String

#>#---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Execute-Process -Path "$dirFiles\BCompare-4.2.6.23150.exe" -Parameters "/VERYSILENT /NORESTART"
New-Folder -Path "$envAppData\Scooter Software\Beyond Compare 4"
Copy-File -Path "$dirSupportFiles\BC4Key.txt" -Destination "$envAppData\Scooter Software\Beyond Compare 4"

Execute-Process -Path 'C:\Program Files\Beyond Compare 4\unins000.exe' -Parameters '/VERYSILENT /NORESTART'

<#------------------------------------------------------------------------------------------------------------------------------------------------------------

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "beycomp_081407.exe", 9

' Give it time to load
WScript.Sleep 1000

'type in Hello World
'WshShell.SendKeys "Hello World!"
WshShell.SendKeys "{ENTER}"
#>#-----------------------------------------------------------------------------------------------------------------------------------------------------------

$PreCheck = (Get-InstalledApplication -Name 'Microsoft Visual C++ 2015 x64 Minimum Runtime')
If ($precheck.DisplayVersion -eq '14.0.24215')
{Write-log "vc++ 2015 Application already installed"}
Else
{ Write-log "Installing Microsoft Visual C++ 2015 x64 Minimum Runtime - 14.0.24215"

Execute-process -path 'vc_redist.x64.exe' -Parameters '/install /quiet /norestart' -IgnoreExitCodes '1638'
}

Execute-MSI -Action 'Install' -Path 'Bluebeam Revu x64 18.msi' -Transform 'X64_Revu_BlueBeam2018_18.1_P1.0_EN.mst' -Parameters '/QN REBOOT=ReallySuppress'

Execute-Process -Path 'BbRevu2018.2_Update2.exe' -Parameters "/silent"


#------------------------------------------------------------------------------------------------------------------------------------------------------------

https://config.office.com/    -----> to create xml file through microsoft website for all office applications


#------------------------------------------------------------------------------------------------------------------------------------------------------------
$OSVersion = (get-itemproperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName).ProductName

If($OSVersion -eq "Windows 7 Enterprise") {

 $path1 = "$envSystemDrive\Windows\System32\oobe\Info"

Set-RegistryKey -Key "HKLM:\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background" -Name "OEMBackground" -Type 'Dword' -Value '1'

$OSVersion = (get-itemproperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName).ProductName

If($OSVersion -eq "Windows 10 Enterprise") {

$WEB = "$envSystemDrive\Windows\Web\Screen\backgroundDefault.jpg"

If (test-path $WEB)
{
Remove-File -Path "$WEB" -Recurse
write-log -message "Files already exists and Removing the files"
}
Copy-Item -Path "$dirFiles\backgroundDefault.jpg" -Destination "$envSystemDrive\windows\web\Screen\" -Force

$WIN10 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization"
$img =  "$envSystemDrive\Windows\Web\Screen\backgroundDefault.jpg"

Set-ItemProperty -Path $WIN10 -Name LockScreenImage -value $img

}
#------------------------------------------------------------------------------------------------------------------------------------------------------------

@echo off
cls
echo --------------------------------------------------------
echo .
echo .
echo .      Installing VLC Media Player - Please Wait
echo .         Window will close once installed

REM Uninstall existing VLC version
if exist "%PROGRAMFILES%\VideoLAN\VLC\uninstall.exe" "%PROGRAMFILES%\VideoLAN\VLC\uninstall.exe" /S
if exist "%PROGRAMFILES(x86)%\VideoLAN\VLC\uninstall.exe" "%PROGRAMFILES% (x86)\VideoLAN\VLC\uninstall.exe" /S
:: Wait for 20 seconds
ping -n 20 127.0.0.1 > NUL

REM Run VLC Installer
"%~dp0DATA\vlc-2.2.6-win32.exe" /language=en_GB /S --no-qt-privacy-ask --no-qt-updates-notif

REM Removes VLC Desktop Icon - Windows XP
if exist "%allusersprofile%\Desktop\VLC media player.lnk" del "%allusersprofile%\Desktop\VLC media player.lnk" /S

REM Removes VLC Desktop Icon - Windows 7
if exist "%public%\Desktop\VLC media player.lnk" del "%public%\Desktop\VLC media player.lnk" /S

REM Remove all the useless shortcuts from Program Menu
if exist "%ProgramData%\Microsoft\Windows\Start Menu\Programs\VideoLAN\Documentation.lnk" del "%ProgramData%\Microsoft\Windows\Start Menu\Programs\VideoLAN\Documentation.lnk" /S

if exist "%ProgramData%\Microsoft\Windows\Start Menu\Programs\VideoLAN\Release Notes.lnk" del "%ProgramData%\Microsoft\Windows\Start Menu\Programs\VideoLAN\Release Notes.lnk" /S

if exist "%ProgramData%\Microsoft\Windows\Start Menu\Programs\VideoLAN\VideoLAN Website.lnk" del "%ProgramData%\Microsoft\Windows\Start Menu\Programs\VideoLAN\VideoLAN Website.lnk" /S

if exist "%ProgramData%\Microsoft\Windows\Start Menu\Programs\VideoLAN\VLC media player - reset preferences and cache files.lnk" del "%ProgramData%\Microsoft\Windows\Start Menu\Programs\VideoLAN\VLC media player - reset preferences and cache files.lnk" /S

if exist "%ProgramData%\Microsoft\Windows\Start Menu\Programs\VideoLAN\VLC media player skinned.lnk" del "%ProgramData%\Microsoft\Windows\Start Menu\Programs\VideoLAN\VLC media player skinned.lnk" /S

REM Return exit code to SCCM
exit /B %EXIT_CODE%


------------------------------------------------------------------------------------------------------------------------------------------------------------
@ECHO OFF
:::::::::::::::::::::::::::::::::::::::::::::::
TITLE Set Custom Wallpaper for Windows 7
:
:::::::::::::::::::::::::::::::::::::::::::::::::
ECHO Set Custom Wallpaper for Windows 7:

ECHO.


:: Set script execution directory:

SET _thisdir=%~dp0

:: Take ownership of original default Wallpaper file:

TAKEOWN /F %SystemRoot%\Web\Wallpaper\Windows\img0.jpg

:: Replace ACLS for original default Wallpaper file with default inherited ACLS:

ICACLS %SystemRoot%\Web\Wallpaper\Windows\img0.jpg /reset


:: Rename original Wallpaper file so it will still be present and usable:
RENAME %SystemRoot%\Web\Wallpaper\Windows\img0.jpg imgX.jpg

:: Copy custom Wallpaper to default Wallpaper location:

XCOPY "%_thisdir%img0.jpg" "%SystemRoot%\Web\Wallpaper\Windows" /C /R /I /K /Y

:: Set Registry for Logon Wallpaper:
REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background /v OEMBackground /t REG_DWORD /d 1

:: Copy custom Wallpaper to Logon Wallpaper location:
mkdir "%SystemRoot%\System32\oobe\info\backgrounds"

XCOPY "%_thisdir%BackgroundDefault.jpg" "%SystemRoot%\System32\oobe\info\backgrounds" /C /R /I /K /Y


-------------------------------------------------------------------------------------------------------------------------------------------------
takeown /f c:\windows\WEB\wallpaper\Windows\img0.jpg
takeown /f C:\Windows\Web\4K\Wallpaper\Windows\*.*
icacls "c:\windows\WEB\wallpaper\Windows\img0.jpg" /E /C /G Users:(F)
icacls C:\Windows\Web\4K\Wallpaper\Windows\*.* /Grant System:(F)
del c:\windows\WEB\wallpaper\Windows\img0.jpg
del /q C:\Windows\Web\4K\Wallpaper\Windows\*.*
copy %~dp0img0.jpg c:\windows\WEB\wallpaper\Windows\img0.jpg
----------------------------------------------------------------------------------------------------------------------------------------------------

citrix reciever

Execute-process -path "$dirSupportFiles\CitrixReceiver.exe" -parameters '/SILENT /uninstall /cleanup'

Execute-process -path "CitrixReceiver.exe" -parameters '/SILENT /noreboot'

-------------------------------------------------------------------------------------------------------------------------------------------------------
Creystal report:


Execute-process -path "$Dirfiles\Setup.exe" -Parameters "-r $Dirfiles\Response.ini"

-------------------------------------------------------------------------------------------------------------------------------------------------------

Set-RegistryKey -Key ‘HKEY_CURRENT_USER\SOFTWARE\FLEXlm License Manager’ -Name ‘LGS_LICENSE_FILE’ -Value ‘@houlics338;@localhost‘-Type String -ContinueOnError:$False

Set-RegistryKey -Key ‘HKEY_CURRENT_USER\SOFTWARE\Leica Geosystems\Cyclone’ -Name ‘LicServer’ -Value ‘houlics338‘-Type String -ContinueOnError:$False

Set-RegistryKey -Key ‘HKEY_CURRENT_USER\SOFTWARE\Leica Geosystems\Cyclone’ -Name ‘LicServers’ -Value ‘houlics338‘-Type String -ContinueOnError:$False


-------------------------------------------------------------------------------------------------------------------------------------------------------

Execute-Process -Path 'cscript.exe' -Parameters "`"$dirOffice\Office15\OSPP.VBS`" /ACT" -WindowStyle Hidden
Execute-Process -Path 'cscript.exe' -Parameters "`"$dirSupportFiles\OffScrub07.vbs`" ClientAll /S /Q /NoCancel" -WindowStyle Hidden -IgnoreExitCodes '1,2,3'

-----------------------------------------------------------------------------------------------------------------------------------------
Show-InstallationWelcome -CloseApps "excel,groove,onenote,infopath,onenote,outlook,mspub,powerpnt,winword,winproj,visio" -AllowDefer -DeferTimes 3 -CheckDiskSpace


----------------------------------------------------------------------------------------------------------------------------------------------------

Execute-Process -Path "$dirFiles\Setup.exe" -Parameters "/modify ProPlus /config `"$dirSupportFiles\AddSharePointWorkspace.xml`"" -WindowStyle Hidden


------------------------------------------------------------------------------------------------------------------------------------------------------------

If ($CurrentLoggedOnUserSession -or $CurrentConsoleUserSession -or $RunAsActiveUser) {
If (Test-Path -LiteralPath (Join-Path -Path $dirOffice -ChildPath 'Office15\OSPP.VBS') -PathType 'Leaf') {
Show-InstallationProgress -StatusMessage 'Activating Microsoft Office components. This may take some time. Please wait...'
Execute-Process -Path 'cscript.exe' -Parameters "`"$dirOffice\Office15\OSPP.VBS`" /ACT" -WindowStyle Hidden
}
}

# Prompt for a restart (if running as a user, not installing components and not running on a server)
If ((-not $addComponentsOnly) -and ($deployMode -eq 'Interactive') -and (-not $IsServerOS)) {
Show-InstallationRestartPrompt
}
}
ElseIf ($deploymentType -ieq 'Uninstall')
{

#========================================================================================================================
If ((test-path -path "C:\path\file1.txt") -and (test-path -Path "C:\path\file2.txt")) {Write-host "found both"}
$textfile = "C:\temp\$($env:Username)_$($env:USERDOMAIN)_$($env:Computername).txt"
# $network = "\\houapps442\AdminStudio\AdminStudioRepository\office users"
# Copy-Item -Path $textfile -Destination  $network -Force  
execute-process -path "Install.cmd" -parameters "/S"
#===========================================================================================================================================================
$Path = "C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\logging"
if(Test-path $Path)
{
$Path + "Exists"
Remove-Item -Path $Path -recurse

}
Else
{}
#=========================================================================================================================================================

Set-RegistryKey -Key ‘HKEY_CURRENT_USER\SOFTWARE\FLEXlm License Manager’ -Name ‘LGS_LICENSE_FILE’ -Value ‘@houlics338;@localhost‘-Type String -ContinueOnError:$False
Execute-process -path "$dirfiles\EdgeWise_v5.2_Network_Installer.exe" -Parameters '/VERYSILENT /NORESTART /LOADINF="$dirfiles\Edgewise.inf"' -WindowStyle 'Hidden'
Copy-File -Path "$dirSupportFiles\sntlconfig.xml" -Destination "$envProgramFiles\ClearEdge3D\EdgeWise\"  
#=======================================================================================================================================================

$MatlabCheck = Get-InstalledApplication -Name "MATLAB Compiler Runtime 8.2"

If ($Matlabcheck.DisplayVersion -eq "8.2") { Write-Log -Message 'Matlab Application is already installed on this device'}
Else
{ Write-Log -Message  'Installing Matlab Compiler Runtime 8.2'    

Execute-process -path "$dirfiles\bin\win64\Install.cmd" -parameters '/S' -continueOnError:$false -WindowStyle 'Hidden'}

Execute-MSI -Action 'Install' -Path 'delft3d_x64_binaries_hydro_morpho_waq.msi' -parameters '/QN'

Execute-MSI -Action 'Install' -Path 'delft3d_x64_tutorial.msi' -parameters '/QN'
#===========================================================================================================================================================

Get a list of applications matching "Drain"
$AppList = Get-InstalledApplication -Name 'Drains'
# Loop through the list, and performing the uninstall
ForEach ($App in $AppList)
{
# Check if the uninstall string exists on the entry, if not we skip.
If($App.UninstallString)
{
# Replacing " to nothing, as execute-process will fail if the path includes a "
$UninstPath = $App.UninstallString -replace '"', ''
# Check if the uninstall file exists, before we try to run it.
If(Test-Path -Path $UninstPath)
{
  # Writing status to log
  Write-log -Message "Found $($App.DisplayName) ($($App.DisplayVersion)) and valid uninstall string, trying to uninstall."
  # Running the actual uninstall.
  Execute-Process -Path $UninstPath -Parameters '/SILENT'
}
}
}
#=======================================================================================================================================================
$iniPath= "$envCommonProgramFilesX86\aladdin Shared\HASP\hasplm.ini"

if ((test-path $inipath))
{
Set-IniValue -FilePath "$envCommonProgramFilesX86\aladdin Shared\HASP\hasplm.ini" -Section 'SERVER' -Key 'enablehaspc2v' -Value '0' -ContinueOnError:$False
Set-IniValue -FilePath "$envCommonProgramFilesX86\aladdin Shared\HASP\hasplm.ini" -Section 'SERVER' -Key 'old_files_delete_days' -Value '90' -ContinueOnError:$False
Set-IniValue -FilePath "$envCommonProgramFilesX86\aladdin Shared\HASP\hasplm.ini" -Section 'SERVER' -Key 'proxyconnect' -Value '0  ; 0=disabled, 1=WPAD, 2=manual' -ContinueOnError:$False
Set-IniValue -FilePath "$envCommonProgramFilesX86\aladdin Shared\HASP\hasplm.ini" -Section 'SERVER' -Key 'proxyhost' -Value '' -ContinueOnError:$False
Set-IniValue -FilePath "$envCommonProgramFilesX86\aladdin Shared\HASP\hasplm.ini" -Section 'SERVER' -Key 'proxyport' -Value '3128' -ContinueOnError:$False
Set-IniValue -FilePath "$envCommonProgramFilesX86\aladdin Shared\HASP\hasplm.ini" -Section 'REMOTE' -Key 'serveraddr' -Value 'PERLICS306' -ContinueOnError:$False
Set-IniValue -FilePath "$envCommonProgramFilesX86\aladdin Shared\HASP\hasplm.ini" -Section 'EMS' -Key 'emsurl' -Value 'http://localhost:8080' -ContinueOnError:$False
Set-IniValue -FilePath "$envCommonProgramFilesX86\aladdin Shared\HASP\hasplm.ini" -Section 'EMS' -Key 'emsurl' -Value 'http://127.0.0.1:8080' -ContinueOnError:$False
}
else{
Copy-File -Path "$dirSupportFiles\hasplm.ini" -Destination "$envCommonProgramFilesX86\aladdin Shared\HASP\" -ContinueOnError:$False
}
#===========================================================================================================================================================
Execute-process -path "$dirfiles\H2OMAPSWMM145008.exe" -parameters "/s /f1$dirfiles\setup.iss"
#==========================================================================================================================================================
Show-InstallationProgress
$AppList = Get-InstalledApplication -Name 'HTRI Xchanger Suite'

If ($AppList.DisplayVersion -eq '7.2.1')
{
Write-log 'Uninstalling HTRI 7.2.1'
Show-InstallationProgress -statusmessage "HTRI 7.2 Uninstallation "
#Remove-MSIApplications -Name 'HTRI'
Execute-process -path "$Dirfiles\Uninstall\Uninstall_7.2.1\HTRI_Xchanger\Setup.exe" -Parameters "/SUPPRESSREBOOT /NOCMDMSG -s -f1$Dirfiles\\Uninstall\Uninstall_7.2.1\HTRI_Xchanger\setup.iss"
Execute-Process -Path "$envSystemRoot\System32\cscript.exe" -Parameters "$dirFiles\Uninstall\Uninstall_7.2.1\Uninstall_ARP.vbs"
Remove-MSIApplications -Name 'HTRI'
Remove-item -Path "C:\users\public\desktop\HTRI Xchanger Suite 7.lnk"
}
ElseIf ($AppList.DisplayVersion -eq '7.3')
{
Write-log 'Uninstalling HTRI 7.3'
Show-InstallationProgress -statusmessage "HTRI 7.3 Uninstallation "
Execute-process -path "$Dirfiles\Uninstall\uninstall_7.3\Setup.exe" -Parameters "/SUPPRESSREBOOT /NOCMDMSG -s -f1$Dirfiles\\Uninstall\uninstall_7.3\setup.iss"
Remove-MSIApplications -Name 'HTRI'
Execute-MSI -Action Uninstall -Path '{06643F3D-97A5-47B3-9BDF-0D8362DBC449}'
Execute-MSI -Action Uninstall -Path '{855EF955-7EF8-4E08-A608-19AA21EE252D}'
Remove-MSIApplications -Name 'HTRI'
Execute-Process -Path "$envSystemRoot\System32\cscript.exe" -Parameters "$dirFiles\Uninstall\uninstall_7.3\Uninstall_ARP.vbs"
$InstDIR = "C:\program Files (x86)\HTRI"
Remove-Item -Force -Recurse -Path $InstDIR
Remove-Folder -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\HTRI"
Remove-item -Path "C:\users\public\desktop\HTRI Xchanger Suite 7.lnk"
Remove-item -Path "C:\users\public\desktop\eLibrary 2.0.6.lnk"
Remove-item -Path "C:\users\public\desktop\HTRI Website.lnk"
}
Else
{ Write-log 'No Previous versions installed'}
#========================================================================================================================================================
Execute-process -path "$Dirfiles\NDP461-KB3102436-x86-x64-AllOS-ENU.exe" -parameters '/q /norestart /log' -IgnoreExitCodes '1638'

Execute-process -path 'C:\windows\system32\icacls.exe' -parameters '"C:\Program Files (x86)\HTRI" /grant users:(OI)(CI)F /T'

start-process "cmd.exe" "/c REG Import $dirFiles\RegLicforHTRI-Win7.reg"

If ($mainExitCode -eq 3010)
 { Show-InstallationRestartPrompt -Countdownseconds 600 -CountdownNoHideSeconds 60 }


Execute-process -path "$Dirfiles\SetupHTRIXchangerSuite7.3.1.exe" -Parameters "/SUPPRESSREBOOT /NOCMDMSG -s -f1$Dirfiles\Setup_uninstall.iss"

Remove-Item -Force -Recurse -Path $InstDIR

<#========================================================================================================================================================
@ECHO OFF

SET InstallPath=%~dp0

For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a:%%b)

@ECHO ================================================================================

@ECHO Installing "Uninstalling IndissPlus 3.6.4.1000"
@ECHO This install takes about 10 minutes to complete...Please be patient...
@ECHO Please do NOT close this prompt...

@ECHO ================================================================================

@ECHO This UnInstall was started at:  %mydate% %mytime%


"C:\Program Files\RSI\IndissPlus 3.6.4\uninstall.exe" /S

TIMEOUT /T 150 >nul

"C:\Program Files\RSI\Viewer 3.6.4\Uninstall.exe" /S

TIMEOUT /T 150 >nul

@if exist "%USERPROFILE%\Desktop\IndissPlus Tools.lnk" del "%USERPROFILE%\Desktop\IndissPlus Tools.lnk"

@if exist "%USERPROFILE%\Desktop\MacroExcel.lnk" del "%USERPROFILE%\Desktop\MacroExcel.lnk"


TIMEOUT /T 20 >nul


#>#==========================================================================================================================================================
Remove-RegistryKey -Key 'HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F64180181F0}' -Name 'DeploymentFile'

<#=================================================================================================================================================
REG write VB Script :


Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WindowsFolder = WshShell.ExpandEnvironmentStrings("%systemroot%")
On error resume next
TEMP= WindowsFolder & "\"

TEMP1= "3"
tEMP2= TEMP & "Web\Wallpaper\Windows\Img0.jpg"
WshShell.RegWrite "HKEY_CURRENT_USER\Control Panel\Desktop\WallpaperStyle",TEMP1,"REG_SZ"
WshShell.RegWrite "HKEY_CURRENT_USER\Control Panel\Desktop\Wallpaper",TEMP2,"REG_SZ"

#>=====================================================================================================================================================
<#====================================================================================================================================================
Start Service : VB Script
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery("Select * from Win32_Service where Name = 'PcaSvc'")
For Each objService in colServiceList
errReturnCode = objService.ChangeStartMode("Automatic")
Next
#>===========================================================================================================================================================
<#stop service through VB Script:

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery("Select * from Win32_Service where Name = 'PcaSvc'")

For Each objService in colServiceList

If objService.State = "Running" Then

objService.StopService()
End If
errReturnCode = objService.ChangeStartMode("Disabled")
Next
#>=================================================================================================================================================================================


Get-Process Communicator | Stop-Process
Get-Process Lync | Stop-Process
Get-Process outlook | Stop-Process
Get-Process UcMapi | Stop-Process
Get-Process msiexec.exe | Stop-Process
## Stop FontCache
Stop-ServiceAndDependencies -Name 'FontCache'
##Uninstall Lync 2010
Remove-MSIApplications -Name 'Microsoft Lync 2010' -Exact
## Uninstall Office 2010
Execute-Process -Path "cscript.exe" -Parameters "`"$dirSupportFiles\OffScrub10.vbs`" PROPLUS /S /Q /NoCancel" -WindowStyle 'Hidden' -IgnoreExitCodes '1,2,3'
##Uninstall Lync 2013
Execute-Process -Path "cscript.exe" -Parameters "`"$dirSupportFiles\OffScrub13.vbs`" LYNC /S /Q /NoCancel" -WindowStyle 'Hidden' -IgnoreExitCodes '1,2,3'

#========================================================================

Split-Path $MyInvocation.MyCommand.Path -Parent   #----->same directory in powershell
$regkeypath = "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration"  
$value1 = ((Get-ItemProperty $regkeypath).'CDNBaseUrl')
If (($regkeypath) -and ($value1 -like 'http://officecdn.microsoft.com/pr/b8f9b850-328d-4355-9145-c59439a0c4cf'))
Try { Set-ExecutionPolicy -ExecutionPolicy 'ByPass' -Scope 'Process' -Force -ErrorAction 'Stop' } Catch {}
Set-RegistryKey -Key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\Korean Pack" -Name "StubPath" -Value "cscript.exe /s $envProgramData\Korean Pack\ActiveSetup.bat" -Type String
Set-RegistryKey -Key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\Korean Pack" -Name "Version" -Value "1.0" -Type String
<#========================================================================
Set WshShell = CreateObject("WScript.Shell")

'Stop the Viewfinity Service
WshShell.Exec("""C:\Program Files\CyberArk\Endpoint Privilege Manager\Agent\vf_agent.exe"" -StopServ")
'Wait 10 seconds
WScript.Sleep(10000)

On Error Resume Next
'Remove previous Agent ID (when the agent starts up again it will generate a new one)
WshShell.RegDelete "HKEY_LOCAL_MACHINE\SOFTWARE\Viewfinity\Agent\AgentID"

'Replace SetID
WshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Viewfinity\Agent\SetID","{2b8ee733-9f56-495d-b70d-6f3dbc0cc685}","REG_SZ"
'Replace DispatcherURL
WshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Viewfinity\Agent\DispatcherURL","http://cyberarkpd.corp.kbr.com/VFAGT/vfagent.asmx","REG_SZ"

'Start the EPM Agent Service
WshShell.Exec("net start vf_agent")
Set WshShell = Nothing



#>#=======================================================================
$AppList = ( Get-InstalledApplication -Name 'HTRI')
If ($AppList.DisplayVersion -eq "7.2.1")
{
Write-log 'Uninstalling HTRI 7.2.1'
Show-InstallationProgress -statusmessage "HTRI 7.2 Uninstallation "
Remove-MSIApplications -Name 'HTRI'
Execute-process -path "$Dirfiles\Uninstall\Uninstall_7.2.1\HTRI_Xchanger\Setup.exe" -Parameters "/SUPPRESSREBOOT /NOCMDMSG -s -f1$Dirfiles\\Uninstall\Uninstall_7.2.1\HTRI_Xchanger\setup.iss"

Execute-Process -Path "$envSystemRoot\System32\cscript.exe" -Parameters "$dirFiles\Uninstall\Uninstall_7.2.1\Uninstall_ARP.vbs"
}
#=======================================================================
$app = Get-WmiObject -Class Win32_Product -Filter "Name = 'YOUR_APP'"
$app.Uninstall()
#---------------------------------------------------------------------------------------------------------------------------------------------------------

net use P: \\maafile300\public$   -- to map any drive
#--------------------------------------------------------------------------------------------------------------------------
$OSVersion = (get-itemproperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName).ProductName

If($OSVersion -eq "Windows 7 Enterprise") {
$path1 = "$envSystemDrive\Windows\System32\oobe\Info"
}
If (test-path $path1)
{
write-log -message "Folder already exists"
}
else{
New-Folder -Path "$envSystemDrive\Windows\System32\oobe\Info"
New-Folder -Path "$envSystemDrive\Windows\System32\oobe\Info\backgrounds"
}
#--------------------------------------------------------------------------------------------------------------------------
Execute-Process -Path 'wusa.exe' -Parameters "`"$($file.FullName)`" /quiet /norestart" -WindowStyle 'Hidden' -ContinueOnError $true
#--------------------------------------------------------------------------------------------------------------------------
#Enable features through powershell :

 Enable-WindowsOptionalFeature -Online -FeatureName "MSMQ-HTTP" -All
 Enable-WindowsOptionalFeature -Online -FeatureName "MSMQ-Triggers" -All
<#--------------------------------------------------------------------------------------------------------------------------
#get registry Value:
function readFromRegistry (strRegistryKey)
Dim WSHShell, value
On Error Resume Next
Set WSHShell = CreateObject("WScript.Shell")
value = WSHShell.RegRead( strRegistryKey )
if err.number <> 0 then
readFromRegistry= strDefault
else
readFromRegistry=value
end if
set WSHShell = nothing
end function
str = readfromRegistry("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Site-Name")
wscript.echo "sitecode is: " & str

#>#--------------------------------------------------------------------------------------------------------------------------
Execute-Process -Path 'setup.exe' -Parameters "/s /v`"ALLUSERS=1 /qn /L* \`"$configToolkitLogDir\$installName.log`"`""
Execute-ProcessAsUser -UserName 'CONTOSO\User' -Path "$PSHOME\powershell.exe" -Parameters "-Command & { & `"C:\Test\Script.ps1`"; Exit `$LastExitCode }" -Wait
Execute-ProcessAsUser -Path "$PSHOME\powershell.exe" -Parameters "-Command & { & `"C:\Test\Script.ps1`"; Exit `$LastExitCode }" -Wait
Get-IniValue -FilePath "$envProgramFilesX86\IBM\Notes\notes.ini" -Section 'Notes' -Key 'KeyFileName'
[scriptblock]$HKCURegistrySettings = {
Set-RegistryKey -Key 'HKCU\Software\Microsoft\Office\14.0\Common' -Name 'qmenable' -Value 0 -Type DWord -SID $UserProfile.SID
Set-RegistryKey -Key 'HKCU\Software\Microsoft\Office\14.0\Common' -Name 'updatereliabilitydata' -Value 1 -Type DWord -SID $UserProfile.SID
}
Invoke-HKCURegistrySettingsForAllUsers -RegistrySettings $HKCURegistrySettings
New-Shortcut -Path "$envProgramData\Microsoft\Windows\Start Menu\My Shortcut.lnk" -TargetPath "$envWinDir\system32\notepad.exe" -IconLocation "$envWinDir\system32\notepad.exe"
Remove-File -Path 'C:\Windows\Downloaded Program Files\Temp.inf'
Set-IniValue -FilePath "$envProgramFilesX86\IBM\Notes\notes.ini" -Section 'Notes' -Key 'KeyFileName' -Value 'MyFile.ID'
Set-PinnedApplication -Action 'PintoStartMenu' -FilePath "$envProgramFilesX86\IBM\Lotus\Notes\notes.exe"
Set-PinnedApplication -Action 'PintoStartMenu' -FilePath "$envProgramFilesX86\IBM\Lotus\Notes\notes.exe"
Show-BalloonTip -BalloonTipText 'Installation Started' -BalloonTipTitle 'Application Name'
Show-BalloonTip -BalloonTipIcon 'Info' -BalloonTipText 'Installation Started' -BalloonTipTitle 'Application Name' -BalloonTipTime 1000
Show-DialogBox -Title 'Installed Complete' -Text 'Installation has completed. Please click OK and restart your computer.' -Icon 'Information'
Show-InstallationProgress -StatusMessage 'Installation in Progress...' -WindowLocation 'BottomRight' -TopMost $false
Show-InstallationRestartPrompt -Countdownseconds 600 -CountdownNoHideSeconds 60
Test-ServiceExists -Name 'testservice' -PassThru | Where-Object { $_ } | ForEach-Object { $_.Delete() }
Update-GroupPolicy
Set-ServiceStartMode -Name 'wuauserv' -StartMode 'Automatic (Delayed Start)'
Remove-File -LiteralPath 'C:\Windows\Downloaded Program Files' -Recurse

User based detection

function getloggedindetails () {     ##Find logged in username     $user = Get-WmiObject Win32_Process - Filter "Name='explorer...

Search This Blog