A huge collection of 3400+ free website templates JAR theme com WP themes and more at the biggest community-driven free web design site
Home / Sin categoría / Packaging Template PowerShell

Packaging Template PowerShell

#Carga Paquete App-V
$pt=’C:\Temp\HP2\CRQ000000626113_HP-ALM-12.53_W7_NAO_R01_2.appv’
$pack=Add-AppvClientPackage $pt
Mount-AppvClientPackage $pack
Publish-AppvClientPackage $pack -Global

#Descarga/Borra paquete App-V
get-appvclientpackage -All|Stop-AppvClientPackage|Unpublish-AppvClientPackage -Global|Remove-AppvClientPackage

###### REPARA APP-V CLIENT

Import-Module «C:\Program Files\Microsoft Application Virtualization\Client\AppvClient\AppvClient.psd1»

#Crea carpeta en todas las carpetas de c:\users

$FUser=Get-ChildItem -Path c:\users | Select-Object name
foreach($usr in $FUser){
if($FUser -notmatch «Public»){
$usrF=$usr.Name
$pt=»c:\users\$usrF\AppData\Local\IntPetro44″
New-Item -Path $pt -ItemType directory -ErrorAction SilentlyContinue
if(Test-Path «$pt\ProgDefs.opt»){Remove-Item «$pt\ProgDefs.opt»}
Copy-Item -Path $configfile -Destination $pt -Force
}

#Comprueba si existe y desinstala

$runSDIL=Get-ItemProperty -ErrorAction SilentlyContinue ‘HKLM:\software\microsoft\windows\currentversion\uninstall\{3BFCF075-E28E-4BD1-B9A2-059A022C89B1}’ |Select-Object DisplayName, DisplayVersion
if ($runSDIL.DisplayVersion -eq ‘1.2.2.5’)
{
$arg=»/X{3BFCF075-E28E-4BD1-B9A2-059A022C89B1} /qn»
$process = Start-Process -FilePath msiexec.exe -ArgumentList $arg -PassThru -ErrorAction SilentlyContinue
Wait-Process -InputObject $process
}

#Comprueba espacio en disco local

$frC=Get-PSDrive C -WarningAction SilentlyContinue
if ($frC.Free -gt ‘8589934592’ -and (Get-PSDrive C))
{
write-host «accion»
}

#SE ELIMINA EL DIRECTORIO EN CASO DE EXISTIR

If (Test-Path -Path $path_config)
{
Remove-Item $path_config -Recurse -Force
}

#MODIFICACIÓN FICHERO EXTENSIONS.INI

Add-Content $File_Extensions_ini $lin1
Add-Content $File_Extensions_ini $ext1

#FUNCION INSTALACION MSI

function RunMsi ($pathFile,$param)
{Start-Process -FilePath msiexec -ArgumentList /i, $pathFile, $param -Wait} #RunMsi «C:\temp\setup2.msi» «/passive»

#FUNCION INSTALACION EXE

Function RunExe($pathExe,$param){
$process = [System.Diagnostics.Process]::Start($pathExe, $param)
$process.WaitForExit()} #RunExe ‘.\SW\setup.exe’ ‘/S /V/qn’

############################# COPIA LICENCIA POR SITE ##############################

$obj = new-object -com ADSystemInfo
$type = $obj.gettype()
$CurrentSite = $type.InvokeMember(«sitename»,»GetProperty»,$null,$obj,$null)

If ($CurrentSite -eq «LABRRIORJ»){
Copy-Item -Path «.\License\Brasil\kw-settings.kws» -Destination «C:\Users\Public\Documents\KAPPA\Settings» -Recurse -force
}

#Eliminar carpeta Temp de AppData AllUsers

$users = Get-ChildItem c:\users | ?{ $_.PSIsContainer }
foreach ($user in $users){
$userpath = «C:\Users\$user\AppData\Local\Temp»
Try{
Remove-Item $userpath\* -Recurse -Whatif -ErrorVariable errs -ErrorAction SilentlyContinue
}
catch {
«$errs» | Out-File c:\temp\errors.txt -append
}
}

#Metodo deteccion DotNet

$ver=Get-ChildItem ‘HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP’ -recurse |
Get-ItemProperty -name Version,Release -EA 0 |
Where { $_.PSChildName -match ‘^(?!S)\p{L}’} |
Select PSChildName, Version, Release, @{
name=»Product»
expression={
switch -regex ($_.Release) {
«378389» { [Version]»4.5″ }
«378675|378758″ { [Version]»4.5.1» }
«379893» { [Version]»4.5.2″ }
«393295|393297″ { [Version]»4.6» }
«394254|394271″ { [Version]»4.6.1» }
«394802|394806″ { [Version]»4.6.2″ }
{$_ -gt 394806} { [Version]»Undocumented 4.6.2 or higher, please update script» }
}
}
}
if($ver.release -cge ‘394271’){return 0}

########## Desinstala por WMI

Function ReturnValue {
gwmi Win32_Product -filter «name like ‘Java%’ AND vendor like ‘Oracle%’ AND (version like ‘8.%’ OR version like ‘1.8.%’)» | % { $_.Uninstall() }
}

IF (ReturnValue = 0) {
.\jre-8u74-windows-i586.exe /s
Start-Sleep -s 50
Get-Item «HKLM:\Software\JavaSoft\Java Update\Policy» | Set-ItemProperty -Name EnableJavaUpdate -Value 0
}

## WMI Repair

@echo off
sc config winmgmt start= disabled
net stop winmgmt /y
%systemdrive%
cd %windir%\system32\wbem
for /f %%s in (‘dir /b *.dll’) do regsvr32 /s %%s
wmiprvse /regserver
winmgmt /regserver
sc config winmgmt start= auto
net start winmgmt
for /f %%s in (‘dir /s /b *.mof *.mfl’) do mofcomp %%s

Sobre nosotros dnx0472

Deja un comentario