Databases Reference
In-Depth Information
Listing 1-1: CheckPowershellPreqs.bat (continued)
REM Check .NET framework
:DOTNETFRAMEWORK_CHECK
wmic product where (caption like "Microsoft .NET Framework%%") get Version /value |
findstr " = [2-9]\.*" > nul
IF "%ERRORLEVEL%" == "1" (
ECHO .NET Framework 2.0 or greater is required
GOTO :END_SCRIPT
)
REM Check Windows remote management
:WINRMCHECK
wmic path Win32_service where caption = "Windows Remote Management (WS-Management)" |
findstr /i "(WS-Management)" > nul
IF "%ERRORLEVEL%" == 1(
ECHO Windows Remote Management is required
GOTO :END_SCRIPT
)
ECHO Your system meets the requirements
:END_SCRIPT
From a Windows command console, run CheckPowershellPreqs.bat from the script directory
C:\DBAScripts . You should get a message similar to the one shown in Figure 1-3 if your system meets
the requirements for a PowerShell installation.
Figure 1-3
You may run into an error as follows on Windows Server 2003:
ERROR:
Code = 0x80041010
Description = Invalid class
Facility = WMI
This means that you need to install the WMI Windows Installer Provider in order for WMIC to work.
To do so, open Control Panel
Add/Remove Programs. Select Add/Remove Windows Components.
Double-click Management and Monitoring Tools. Select WMI Windows Installer Provider, and then click
OK to install.
If your operating system is Windows XP Service Pack 2 and you install Windows PowerShell 2.0 CTP3, it
may or may not work. The officially supported service pack for Windows XP when installing Windows
Search WWH ::




Custom Search