Showing posts with label Batch. Show all posts
Showing posts with label Batch. Show all posts

Wednesday, February 20, 2013

Shell Script Find Windows Version and Architecture

Problem: I need to find a script to find version and processor architecture windows in a windows shell script.

Soltuion: 

Batch/CMD Script
:; Find Windows Version and ArchitectureFOR /F "tokens=*" %%i in ('VER') do SET WinVer=%%i FOR /F "tokens=1-3 delims=]-" %%A IN ("%WinVer%" ) DO ( SET VarString=%%A )
FOR /F "tokens=1-9 delims=n" %%A IN ("%VarString%" ) DO ( SET WinVer=%%C)
FOR /F "tokens=1-8 delims=.- " %%A IN ("%WinVer%" ) DO (SET WinMajor=%%ASET WinMinor=%%B)
:; Set version+archicitecher string. 5.1.x86 is Windows XP x86, 6.1.x86 is Windows 7 x86, & 6.1.AMD64 is Windows 7 x64SET VerArch=%WinMajor%.%WinMinor%.%processor_architecture% 
 Powershell
# Find processor architecture and Windows version$processorArchitecture = (Get-ItemProperty 'HKLM:\SYSTEM\ControlSet001\Control\Session Manager\Environment').PROCESSOR_ARCHITECTURE$windowsVersion = (Get-WmiObject Win32_OperatingSystem).Version | %{$data = $_.split("."); Write-Output "$($data[0]).$($data[1])"}


Tuesday, February 19, 2013

Deploying Adobe Flash 11 Windows 7 64 bit

Problem:
I kept getting an error when deploying Adobe Flash 11.X to my Windows 7 64 bit workstations.
The error "This file does not have a program associated with it for performing this action. ..." Would pop up at the end of the installation and would cause the deployment task to hang until someone click "OK".


Solution/Deployment Task:
Set compatibility to Windows XP SP3 before installing.

1. Download standalone executables from Adobe.
http://download.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_11_active_x.exe
http://download.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_11_plugin.exe

2. Check if browsers are running.
REM Check if browser is running Exit 1
tasklist|find /i "iexplore.exe"
IF %ERRORLEVEL%==0 EXIT 1
tasklist|find /i "firefox.exe"
IF %ERRORLEVEL%==0 EXIT 1
tasklist|find /i "chrome.exe"
IF %ERRORLEVEL%==0 EXIT 1
tasklist|find /i "Safari.exe"
IF %ERRORLEVEL%==0 EXIT 1
EXIT 0
3. Copy install_flash_player_11_plugin.exe, and install_flash_player_11_active_x.exe executables to "C:\Windows\Temp\".

4. Set compatibility to Windows XP SP3 for the executables.
REM Set compatibility install_flash_player_11_plugin.exe
reg.exe Add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\Windows\Temp\install_flash_player_11_plugin.exe" /d "WINXPSP3" /f
REM Set compatibility install_flash_player_11_active_x.exe
reg.exe Add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\Windows\Temp\install_flash_player_11_active_x.exe" /d "WINXPSP3" /f
5. Execute the installation.
REM Install install_flash_player_11_plugin.exe
C:\windows\temp\install_flash_player_11_plugin.exe /install
REM Install install_flash_player_11_active_x.exe
C:\Windows\Temp\install_flash_player_11_active_x.exe /install
6. Take out the trash.
REM Delete install_flash_player_11_plugin.exe
DEL "C:\windows\temp\install_flash_player_11_plugin.exe"
REM Delete install_flash_player_11_active_x.exe
DEL "C:\Windows\Temp\install_flash_player_11_active_x.exe"