6:35 PM in Windows Scripts by MLK
Description/Problem:
As you know the Windows Server 2008 doesn’t support System State Backup from GUI. Still existing possibility how to create the System State Backup via command line. You can use this backup in case of problem with unstable system (ex. issue after patching or upgrade of drivers, …).
Solution:
- Every day at 21:55 the system checks the latest System State Backup stored on drive D: and remove all related data:
SCHTASKS /Create /RU "NT AUTHORITY\SYSTEM" /SC DAILY /ST 21:55:00 /TN "System State Backup (Remove)"
/TR "wbadmin delete systemstatebackup -backuptarget:d: -deleteoldest -quiet" /RL highest
- Every day at 22:00 system create new System State Backup:
SCHTASKS /Create /RU "NT AUTHORITY\SYSTEM" /SC DAILY /ST 22:00:00 /TN "System State Backup (Create)"
/TR "wbadmin start systemstatebackup -backuptarget:d: -quiet" /RL highest
Before you apply these commands to server be sure that you have disk D: ready for daily backups and free disk space is about 12 – 16 GB. For servers which are holding some SAP or SQL instances is recommended size for disk D: about 48 – 64 GB.
Tags: backup, system state, windows
8:30 PM in Windows Scripts by MLK
Description/Problem:
The configuration of Microsoft Windows Server 2008 R2 – Core Edition (x64) via standard command line or Windows PowerShell is not easy and may consume lot of time and nerves. That’s the reason why we would like to recommend you small script solution which allow you to easy and fast configuration of product licensing, networking features, DCPromo, iSCSI settings, server roles and features, share creation and deletion, dynamic firewall settings, add & remove drivers, Hyper-V, system services, … . It’s nice and powerful tool. Small negative is that this tool does not work on Windows Server 2008 R2 – Core Edition (x86).
Solution:
CoreConfig Team / Download Core Configurator 2.0
Tags: config, server core, setup, windows
9:15 PM in Windows Events, Windows Scripts by MLK
Description/Problem:
We spent with the installation of MS Windows Server 2008 (x86/x64) systems several days. For these servers we needed to perform flexible emergency solution (fast boot-up to recovery console) which will allow us to restore the server from local or remote backups, restore critical files, remove malware, recover the corrupted system registry or file system, etc. We have chosen the Windows Server 2008 Preinstallation Environment (PE) with integrated Microsoft Diagnostics and Recovery Toolset (MS DaRT). Except the standard DVD edition, we preferred to boot-up the recovery solution also from local system. From this reason we created small script which modified the Boot Loader.
You can use this script for systems which are pre-installed via SysPrep Tool. In this situation you need to store this script into the folder “C:\Windows\Setup\Scripts” and file “SetupComplete.cmd” which will be executed after the SysPrep Process.
Solution:
- Copy from DVD “\boot\boot.sdi” to the system disk “C:\boot”
- Create new folder called “recovery” on the system disk C: and set the hidden flag for folder (only)
- Copy from DVD “\sources\boot.wim” to the system disk “C:\recovery”
- Create new batch file, save script presented below into this file and execute it
bcdedit /create {ramdiskoptions} /d "Microsoft Windows Server 2008 Recovery Console"
bcdedit /set {ramdiskoptions} ramdisksdidevice partition=c:
bcdedit /set {ramdiskoptions} ramdisksdipath \boot\boot.sdi
for /f "tokens=1-3" %%a in ('Bcdedit /store c:\boot\bcd /create /d "Microsoft Windows Server 2008 Recovery Console" /application osloader') do set WINPE_GUID=%%c
bcdedit /set %WINPE_GUID% device ramdisk=[c:]\recovery\boot.wim,{ramdiskoptions}
bcdedit /set %WINPE_GUID% path \windows\system32\boot\winload.exe
bcdedit /set %WINPE_GUID% osdevice ramdisk=[c:]\recovery\boot.wim,{ramdiskoptions}
bcdedit /set %WINPE_GUID% systemroot \windows
bcdedit /set %WINPE_GUID% winpe yes
bcdedit /set %WINPE_GUID% detecthal yes
bcdedit /timeout 10
bcdedit /displayorder %WINPE_GUID% /addlast
Tags: bcdedit, boot, wim image, windows, windows pe
10:30 PM in Windows Events, Windows Scripts by MLK
Description/Problem:
Find the solution without investigation and troubleshooting is sometimes not so easy. Our last issue was related to MS Windows Server 2003 (Service Pack 2, R2 Edition), including latest patches. Performance of this server rapidly decreased but all system services were up and running (very slowly). We identify some errors related to Windows Management Instrumentation (WMI) in the Event Logs. The script (published in this article) for re-register of WMI was not solving our issue. Therefore, we decided to reinstall the WMI.
Solution:
# Detect and repair corrupted WMI repository
rundll32 wbemupgd, RepairWMISetup
# Stop the WMI service
net stop winmgmt
# Comprehensive rebuild method (Windows Server 2003 installation DVD is needed)
rundll32.exe setupapi,InstallHinfSection WBEM 132 %windir%\inf\wbemoc.inf
# Start the WMI service
net start winmgmt
Tags: re-register, repair, windows, wmi
10:10 PM in Windows Scripts by MLK
Description/Problem:
Sometimes is not possible activate the MS Windows Server 2008 during installation process, for example when you need to prepare the installation image for many servers in your company. In this situation it’s better to install MS Windows Server 2008 in trial period and then continues with activation process later on. You have several options how to perform activation process: fully automated GUI, automatic phone-line or powerful command line script. The last option is the best one if you need activate (locally or remotely) more servers in your company via script.
Solution:
# Insert new valid product key to the system:
cscript C:\Windows\System32\slmgr.vbs -ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
# Manually activate new product key:
cscript C:\Windows\System32\slmgr.vbs -ato
# Verify the status of activation process:
cscript C:\Windows\System32\slmgr.vbs -xpr
# Detail information about the license:
cscript C:\Windows\System32\slmgr.vbs -dlv
# Remote activation of Windows Server 2008:
cscript C:\Windows\System32\slmgr.vbs computer-name user-name password parameter
Don’t forget that your computer must be able access the Internet otherwise the activation process will be not success.
Tags: activation, command line, product key, windows
7:45 PM in Windows Scripts, Windows Tools by MLK
Description/Problem:
I suppose that every administrator is very familiar with scripted system configuration gathering tool called Microsoft Product Support Reports (MPSR). We are using this tool in our daily life for creating the reports which we can use for deep analysis of critical system issues or attached as part of software calls managed by Microsoft Premier Support.
Download:
Microsoft.com
Tags: reports, software calls, support, windows
8:00 PM in Windows Events, Windows Scripts by MLK
Description/Problem:
Some weeks ago we used the HP Insight Server Migration Pack (HP ProLiant Server) for migration of server from old to new hardware. Migration process finished successfully and everything seems fine. After standard system checks and tests we identify small problem related to execution of some EXE files. Each try to execute EXE file failed with error message: Application error: The instruction at “0×10015026″ referenced memory at “0×00000000″. The memory could not be “read”.
Solution:
Based on our investigation we identify that problem is related to the Windows Management Instrumentation (WMI). We resolved the issue by running below script.
@echo on
cd /d c:\temp
if not exist %windir%\system32\wbem goto TryInstall
cd /d %windir%\system32\wbem
net stop winmgmt
winmgmt /kill
if exist Rep_bak rd Rep_bak /s /q
rename Repository Rep_bak
for %%i in (*.dll) do RegSvr32 -s %%i
for %%i in (*.exe) do call :FixSrv %%i
for %%i in (*.mof,*.mfl) do Mofcomp %%i
net start winmgmt
goto End
:FixSrv
if /I (%1) == (wbemcntl.exe) goto SkipSrv
if /I (%1) == (wbemtest.exe) goto SkipSrv
if /I (%1) == (mofcomp.exe) goto SkipSrv
%1 /RegServer
:SkipSrv
goto End
:TryInstall
if not exist wmicore.exe goto End
wmicore /s
net start winmgmt
:End
Tags: hp insight, issue, migration, windows
6:50 PM in Windows Scripts, Windows Tools by MLK
Description/Problem:
The NC_Net is well-known as Windows monitoring agent for Nagios. Performs both Passive and active checks, as well as WMI checks, and external script running. Full local or remote configuration. Core of this utility is based on .Net Framework 2.0. I found the article which help me to solve problem with hanging NC_Net agent after the Windows system start-up.
Solution:
Ubergeek Technical Howtos’ & SourceForge.Net
Tags: monitoring, nc_net, windows, wmi