WebVision-It

Just another WebvIsion weblog

Script: install Office

if exist “C:\Program Files\Microsoft Office\Office16” goto :eof ELSE
\\Smbfolder\\setup.exe /adminfile \\Smb-Folder\Office.MSP

 

to create the MSP file Please run cmd

go to office install folder and run

setup.exe /admin

then you will see options for the MSP file

Provide the data that you wish to enter as KEY and more

and then save the file in the SMB folder

for more info

Automate the Install of Microsoft Office 2016 with an MSP File

 

 

Script: install TighVnc

echo Installing TightVNC

@echo Check if Program Is Installed
if exist “C:\Program Files (x86)\TightVNC” goto :eof ELSE
if exist “C:\Program Files\TightVNC” goto :eof ELSE

@echo Installing
msiexec /i “\\your-smb\tightvnc-2.8.8-gpl-setup-64bit.msi” /quiet /norestart ADDLOCAL=”Server” VIEWER_ASSOCIATE_VNC_EXTENSION=1 SERVER_REGISTER_AS_SERVICE=1 SERVER_ADD_FIREWALL_EXCEPTION=1 VIEWER_ADD_FIREWALL_EXCEPTION=1 SERVER_ALLOW_SAS=1 SET_USEVNCAUTHENTICATION=1 VALUE_OF_USEVNCAUTHENTICATION=1 SET_PASSWORD=1 VALUE_OF_PASSWORD=”272612″ SET_USECONTROLAUTHENTICATION=1 VALUE_OF_USECONTROLAUTHENTICATION=0 SET_CONTROLPASSWORD=1 VALUE_OF_CONTROLPASSWORD=“Your-Password” SET_VIEWONLYPASSWORD=1 VALUE_OF_VIEWONLYPASSWORD=“Your-Password”
net stop “TightVNC Server”
net start “TightVNC Server”

Script: install Sophos AV

@echo off
SET MCS_ENDPOINT=Sophos\Management Communications System\Endpoint\McsClient.exe
IF “%PROCESSOR_ARCHITECTURE%” == “x86” GOTO X86_PROG
IF NOT EXIST “%ProgramFiles(x86)%\%MCS_ENDPOINT%” GOTO INSTALL
exit /b 0

:X86_PROG
IF NOT EXIST “%ProgramFiles%\%MCS_ENDPOINT%” GOTO INSTALL
exit /b 0

:INSTALL
pushd \\your-server\your-folder
SophosMcsEndpoint_RCB8R6NFYP1MCfb2b.exe -q

@echo backup install
msiexec /i “\\your-server\your-folder\file.exe”
Popd

Script: clean iss logs

sLogFolder = “c:\inetpub\logs\LogFiles”
iMaxAge = 30 ‘in days
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
set colFolder = objFSO.GetFolder(sLogFolder)
For Each colSubfolder in colFolder.SubFolders
Set objFolder = objFSO.GetFolder(colSubfolder.Path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
iFileAge = now-objFile.DateCreated
if iFileAge > (iMaxAge+1) then
objFSO.deletefile objFile, True
end if
Next
Next

Script Clear Exchange 2013/2016 Log & ETL Files

  • save the text in PS1 file, and create Task to Run the script

Set-Executionpolicy RemoteSigned
$days=0
$IISLogPath=”C:\inetpub\logs\LogFiles\”
$ExchangeLoggingPath=”C:\Program Files\Microsoft\Exchange Server\V15\Logging\”
$ETLLoggingPath=”C:\Program Files\Microsoft\Exchange Server\V15\Bin\Search\Ceres\Diagnostics\ETLTraces\”
$ETLLoggingPath2=”C:\Program Files\Microsoft\Exchange Server\V15\Bin\Search\Ceres\Diagnostics\Logs”
Function CleanLogfiles($TargetFolder)
{
if (Test-Path $TargetFolder) {
$Now = Get-Date
$LastWrite = $Now.AddDays(-$days)
$Files = Get-ChildItem $TargetFolder -Include *.log,*.blg, *.etl, *.txt -Recurse | Where {$_.LastWriteTime -le “$LastWrite”}
foreach ($File in $Files)
{Write-Host “Deleting file $File” -ForegroundColor “white”; Remove-Item $File -ErrorAction SilentlyContinue | out-null}
}
Else {
Write-Host “The folder $TargetFolder doesn’t exist! Check the folder path!” -ForegroundColor “white”
}
}
CleanLogfiles($IISLogPath)
CleanLogfiles($ExchangeLoggingPath)
CleanLogfiles($ETLLoggingPath)
CleanLogfiles($ETLLoggingPath2)