Posts

Base 64 encoding and decoding

Encoding and decoding of BASE64 format strings for Apache Tomcat web server.  java -cp /usr/tcServer-6.0/tomcat-6.0.33.B.RELEASE/lib/tcServer.jar:/usr/tcServer-6.0/tomcat-6.0.33.B.RELEASE/bin/tomcat-juli.jar:/usr/tcServer-6.0/tomcat-6.0.33.B.RELEASE/lib/tomcat-coyote.jar com.springsource.tcserver.security.PropertyDecoder -encode / -decode base64 <password>

Windows Services, Diskspace, Scheduled Job and URL monitoring in C#

Windows Services, Diskspace, Scheduled Job and URL monitoring in C#:   XmlDocument doc = new XmlDocument();             doc.Load("../../Services_File.xml");             XmlNodeList nodeList = doc.DocumentElement.SelectNodes("/WindowsServices/ServiceList");             string server = "", services = "";             foreach (XmlNode spcnode in nodeList)             {                 server = spcnode.SelectSingleNode("Server").InnerText;                 services = spcnode.SelectSingleNode("Services").InnerText;                 string[] svcList = services.Split(';');                 foreach(string svc in svcList)               ...

Some Interview Questions: C#

It is also permissible to declare multiple variables of the same underlying type on a single line of code, as in the following three bool variables bool b1 = true, b2 = false, b3 = b1; All intrinsic data types support what is known as a default constructor. This feature allows you to create a variable using the new keyword, which automatically sets the variable to its default value bool b = new bool();              // Set to false.   int i = new int();                // Set to 0.   double d = new double();          // Set to 0.   DateTime dt = new DateTime();     // Set to 1/1/0001 12:00:00 AM All the data types have been derived from System.Object class.  The value types are the types that have System.ValueType in their chain of inheritance.  U...

SOAP request through power shell

$postBody = Get-Content -Raw -Path "E:\body.xml" $url = "https://someservice/service" $currentDate = Get-Date $guid = [guid]::NewGuid() $nameOfCertificate = "<certname>" $headers = @{"SOAPAction" = "<MethodName>"} $currentDate</b:MessageText>" #Get current location $currentLocation = (Get-Location).Path Write-Host "ServerName:$env:COMPUTERNAME" #Set Location where to get the cerificate Set-Location Cert:\LocalMachine\My #Get the certificate to be used $certificate = Get-ChildItem | where {$_.Subject.Contains($nameOfCertificate)} try{     $postBody = $postBody.Replace("9bfcb841-2701-4ba4-ada7-0d44445b2dbe",$guid)             $response = Invoke-WebRequest -Method Post -Uri "$url" -Body $postBody -ContentType 'text/xml' -Headers $headers -Certificate $certificate     $xmlResponse = [xml]$response.Content     } catch [exception] {    echo $_.Exc...

VB Scripts for Windows Server Monitoring

Various VB Scripts for Server Monitoring : 1) IIS Status Set colOperatingSystems = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") For Each objOperatingSystem In colOperatingSystems  OSVer= objOperatingSystem.Caption  If InStr(1,OSVer,"2008") > 0 Then      objFile.WriteLine OSVer      WinSevIISFn()     Else    WinThrIISFn() 'create win 2003 server function   End If  Next Function WinSevIISFn()  IISbatpath   = objFSO.GetParentFolderName(WScript.ScriptFullName) & "\IISState.bat"  objShell.run IISbatpath  WScript.sleep(1000)  webstpath      = objFSO.GetParentFolderName(WScript.ScriptFullName) & "\Websitestate.txt"  Appplstpath    = objFSO.GetParentFolderName(WScript.ScriptFullName) & "\AppPoolsstate.txt"  objIISwebState = objFSO.OpenTextFile(webstpath, ForReading).ReadAll  objII...

Upload file through SFTP : Command Line

option echo off option batch on option confirm off open sftp://was@10.121.144.78:22/ -privatekey=E:\key.ppk -passphrase="passphrase" lcd E:\ put -nopermissions -nopreservetime *.zip /usr/*.zip exit

VB Script for IIS Health Check

Dim tempstatus Dim spaced Dim usernamea Dim username Dim sFile, dFSO Dim serverstatus Dim userid,tempuserid Dim outmem Dim wql Dim StrQuery Dim Htout Dim Appstatus1 Dim Appstatus2 serverstatus="Normal" userid=0 tempuserid=0 On Error Resume Next Set objNTInfo = CreateObject("WinNTSystemInfo") serverName = lcase(objNTInfo.ComputerName) Set objNTInfo = nothing Htout=Htout+"<table border=1 bgcolor='#000080' width=100%><tr><th align=left>"_              + FormatHeaderColumn("Production ICE Web Heath Check") +"</th></tr></table><table border=1 bgcolor='#000080' width=100%><tr><th align=left>"_              + FormatHeaderColumn("Server-Name") + "</th><th align=left >" +  FormatHeaderColumn("AppPools-Status")_              + "</th><th align=left >" + FormatHeaderColumn("W3wp-Usage...