LiquidObject

Manual SCOM client migration

Today I had the task of migrating a number of systems over to the SCOM 2012 server with the existing server being offline. Running the normal discovery fails to redirect the nodes over to the system because of a pair of registry entries still pointing to the old system. The below batch script can be run one at a time or via some automation method (Config Manager in my case) to mass-migrate nodes over to the new system.

@REG ADD "HKLM\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\Agent Management Groups\LiquidObject\Parent Health Services\0" /v "AuthenticationName" /d "SCOM-1.liquidobject.com" /f
@REG ADD "HKLM\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\Agent Management Groups\LiquidObject\Parent Health Services\0" /v "NetworkName" /d "SCOM-1.liquidobject.com" /f

@NET STOP HEALTHSERVICE
@NET START HEALTHSERVICE
, ,
December 28, 2012 at 2:12 pm Comments (0)

Simple CSR generation for Apache/Tomcat on Windows

Under the KISS method generating Apache/Tomcat certificate requests (CSRs) under Windows can be a pain if you don’t do it that often. Below is a sample batch script to automatically generate the certificates for you.

echo off
REM building up the variables

set myFQDN=%COMPUTERNAME%.liquidobject.com
set myFileBase=%COMPUTERNAME%_liquidobject.com
set myJavaPath=C:\jdk1.6.0_14\bin\
set myOutputPath=C:\ssl_keys\
set myKeySize=2048
set myOrganization=OU=My Department, O=My Business, L=My City, ST=My State, C=us

REM variables set
cls
echo.
echo.
echo Generating a certificate for %myFQDN%, please wait...
echo.
echo.
echo Please supply a password for the keystore file
echo.
%myJavaPath%keytool -genkey -alias server -keyalg RSA -keysize %myKeySize% -keystore %myOutputPath%%myFileBase%.jks -dname "CN=%myFQDN%, %myOrganization%"
%myJavaPath%keytool -certreq -alias server -file %myOutputPath%%myFileBase%.csr -keystore %myOutputPath%%myFileBase%.jks
echo.
echo.
echo Your certificate signing request is in %myFileBase%.csr.
echo Your keystore file is %myFileBase%.jks.
echo.
echo.
echo CSR output below:
echo.
more %myOutputPath%%myFileBase%.csr
echo on
, , ,
July 12, 2012 at 3:10 am Comments (0)

Old File Cleaner

To go along with the purging of IIS log cleaner, this is a more generic recursive file cleaner using PowerShell for files based up on date specified.

#==============================================
#       --- Configuration Options ---
#Provide the name of the site
$mydir  = 'C:temp'
#Provide the number of days you wish to keep
$days = 4
#whatif toggle, verify only option
$whatif = $true
#==============================================

if($whatif)
{
get-childitem $mydir -recurse | 
	where {$_.lastwritetime -lt (get-date).adddays(-$days) -and -not $_.psiscontainer} |% {remove-item $_.fullname -force -WhatIf }
	}
else
{
get-childitem $mydir -recurse | 
	where {$_.lastwritetime -lt (get-date).adddays(-$days) -and -not $_.psiscontainer} |% {remove-item $_.fullname -force -ErrorAction SilentlyContinue} | Write-Host $_.fullname
}

In the case you need to run a similar function on older systems, here’s a more basic version suitable for a BAT file. FYI, there is no error checking option in this method.

FORFILES /P "C:temp" /S /D -7 /c "CMD /C del /F /Q @file"

Where 7 is the number of days you wish to keep the files. This also requires the FORFILES command to be available

, ,
January 31, 2011 at 7:51 am Comments (0)

Bulk DNS query test

If you ever run into periodic DNS look-up or connectivity problems this script may come into use. When pairing this with www.wireshark.org you can help troubleshoot periodic packet-loss issues.

@ECHO off
mode con:cols=110 lines=40
COLOR A
del ns_log.txt
cls
echo.
echo.
echo -----------------------------------------------------
echo starting lookup loop
echo -----------------------------------------------------
for /L %%X in (1,1,100) do (
nslookup %%X-DNS-test.mycompany.org 8.8.8.8
		
if "google"==^%%i (echo Fail on ^%%X) else (echo ok on ^%%X)
)
echo -----------------------------------------------------
echo lookup look finished
echo -----------------------------------------------------
echo.
echo.
echo >NUL 2>&1 
January 30, 2011 at 9:05 pm Comments (0)