Archive for Technical Posts
Creating Trend Officescan installer package using clnpack.exe
Posted by: | CommentsToday I was trying to use clnpack.exe fom a command line to automatically create updated installation packages for Trend Officescan on a weekly basis. This seemed a simple case of putting together a command line but I wasn’t having any luck getting it working.
Annoyingly clnpack.exe does not give any error messages at all if the syntax of the commad is not perfect and you get nowhere. In the end I discovered that I could only make clnpack.exe work by using 8.3 file paths instead of long path names.
An example of a working command line:
C:\PROGRA~1\TRENDM~1\OfficeScan\PCCSRV\Admin\Utility\ClientPackager\clnpack.exe /i /o NT /s C:\PROGRA~1\TRENDM~1\OfficeScan\PCCSRV /d d:\shared~1\software\trend32.exe
You can see 8.3 format filenames by going into a command prompt and using:
dir /x
Now that I have this command working I can integrate it with a batch file which will upload it to our web server.
Automated and conditional reboots of Draytek routers via telnet
Posted by: | CommentsThis is a script that I posted to the Draytek forum a couple of years ago, I noticed that it has been a very popular post so I have decided to post here also.
The function of the script is to perform scheduled reboots of Draytek routers. Optionally is it possible to reboot the router only if a specified IP address does not respond to a ping request. This is useful to test if a VPN connection is functioning, and only reboot the router if there is no response.
Early Draytek firmwares had a tendancy to lose VPN connectivity and a reboot is the only way to restore the connection.
First of you need to install the Toolsack Baseline components for this script to work:
http://www.toolsack.com/download/
The script needs to be supplied with parameters, so a typical command line would look like this:
cscript reboot.vbs 86.11.93.131 routerpassword
and a conditional command line would look like this:
cscript reboot.vbs 86.11.93.131 routerpassword 192.168.1.254
The 3rd argument will be tested for a ping response, if none is received then a reboot will be executed.
Here is the code, save it as reboot.vbs:
set args=wscript.arguments
If wscript.arguments.count=2 then
IP=args.item(0)
Password=args.item(1)
call reboot(IP,Password)
elseif wscript.arguments.count=3 then
IP=args.item(0)
Password=args.item(1)
TestIP=args.item(2)
if ping(TestIP)=False then
call reboot(IP,Password)
end if
else
wscript.echo "Invalid number of arguments specified"
wscript.echo "Please specify router IP address & password and optional test IP"
end if
sub reboot(IP, Password)
set s = CreateObject("Toolsack.Socket")
s.Connect IP, 23
s.Write Password & vbCrLf
s.write "sys reboot" & vbcrlf
s.write "quit" & vbcrlf
end sub
Function Ping(strHost)
dim objPing, objRetStatus
set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
("select * from Win32_PingStatus where address = '" & strHost & "'")
for each objRetStatus in objPing
if IsNull(objRetStatus.StatusCode) or objRetStatus.StatusCode<>0 then
Ping = False
else
Ping = True
end if
next
End Function
Small Business Server 2003 – Backup Status Hangs on Loading…
Posted by: | CommentsHad a customer report a problem today with the Small Business Server Managment console not being able to show the status of the backups and just hanging at “Loading…”
Visiting the backup URL manually ( http://localhost/backup/default.aspx ) enabled me to see the backup reports as normal. Had a quick look in the code of default.htm which is the page that the “Manage Small Business Server Backup” console loads and saw that it is really just a javascript redirect.
Turns out that this server had scripting disabled for the intranet zone and therefore the page redirection was never happening.
Once scripting was enabled again the backup console started working as expected. Couldn’t find mention of anyone else having this problem so thought I would post.
New-ExchangeCertificate Cmdlet Syntax Generator
Posted by: | Comments
I am always forgetting the syntax for the New-ExchangeCertificate cmdlet when I need to do a new certificate request so I decided to write a little bit of javascript to build up the command automatically. Its much easier to copy and paste it from here than work with in it the Exchange 2007 Command Shell.
So just fill in the fields below and the command will be built automatically in the box below. Then just copy into command shell. If required, seperate the “Subject Alternative Names” with commas.
|
Common Name: |
|
| Subject Alternative Names: | |
| Organisation: | |
| Organisational Unit: | |
| Town/City: | |
| County/State: | |
| Country: |
CSR Command:
I am thinking of duplicating this code and writing another post which will generate the commands for the import of the newly generated certificate.
Setting up email alerts from Dell Openmanage (OMSA)
Posted by: | CommentsDell Openmanage Server Administrator is a really useful tool for configuring and monitoring server hardware but it lacks built in E-Mail alerting or notifications.
The software is capable of calling external programs or scripts when a server alert is triggered so I have written a simple script that provides E-Mail alert functionality.
There are a couple of scripts out there that do similar, but I wanted something self contained and capable of using SMTP Authentication with an external relay.
The other problem with OMSA is that you need to go into each individual alert to configure the settings which can be very time consuming, I wanted a way to add them all automatically as I am going to install the script on a number of servers.
Install the script by extracting the DellAlert.Vbs script file from this zip file:
Once you have extracted the zip file you will need to edit the variables at the top of the script to make them appropriate for your environment:
The variables at the top define the e-mail settings and are hopefully self explanatory. If a remote SMTP server is not specified the local machine will be used to send the E-Mail.
Below these you can to decide what events you want to be notified of, just comment out any that you aren’t interested in, e.g:
AlertConfig(0)="powersupply|Power supply failure"
AlertConfig(1)="powersupplywarn|Power supply warning"
'AlertConfig(2)="tempwarn|Temperature warning"
'AlertConfig(3)="tempfail|Temperature failure"
I have included every alert available in OMSA 6.2 on a PE T710, some of these alerts won’t be available on older versions or machines.
After you have configured the script, I suggest you test that the E-Mail options by running:
cscript dellalert.vbs testemail
You should receive a test e-mail, if not something isn’t working properly.
When you have successfully tested e-mail, configure OMSA to send alerts by running:
cscript dellalert.vbs setup
You will then see the script go through and setup all the appropriate alerts as per your settings. This process can take a couple of minutes as the “omconfig” command takes a while. This step will not work if you do not have OMSA installed.
Once this is done you should be able to see that the script has been added into OMSA:
Now you need to generate some real alerts to test the script properly. How you do this will depend on the capabilities of your server, I was able to disconnect the redundant power supply and have an alert generated almost immediately. I think opening the case will also generate an event, but I am not sure as I didn’t test. Hopefully you should get something like this in your Inbox:
I have installed this on a few servers and it seems to be working well. I will update the script with any tweaks that I add as I roll it out further. Hope this is useful to someone else.
If you are using Exchange 2007…..
This script will not work properly until you register the 32-Bit version of cdo.dll. Follow the instructions for doing this here:
Recovering saved FTP Passwords using a simple netmon filter
Posted by: | CommentsToday I needed to FTP some files to a site that I have used on and off for a number of years. Because I have recently installed Windows 7 I needed to setup the site again in my FTP Client, Core FTP.
Although my old machine still has the connection setup I was not able to see the cached/saved password. Although it is possible to export the sites, the password remained encrypted and I wanted to document the actual password.
There are a lot of tools, some free and some which you have to pay for which will recover the cached FTP password for you. Some of these looked a bit questionable and as FTP is an entirely unencrypted service I thought it should be easy to sniff the password out of the FTP traffic itself.
Turns out that it really is very easy and the saved password can be retreived instantly using netmon.
So here is how to do it.
Create a new capture filter in netmon and enter the following:
tcp.Port==21 and property.TCPPayload.contains("PASS")
Should look like this:
Then click on the start button to begin capture. Then open your FTP client which contains the cached password and connect to the FTP server.
As soon as you have made a succesful connection switch back to netmon and stop the capture. You should then be able to see the FTP password in clear text in the capture window, something like this:
I spotted a lot of posts from people trying to recover or export their saved FTP passwords from CoreFTP and CuteFTP and many programs are designed specifically for this purpose. This is quick and simple and does not depend on any 3rd party software and should work with any FTP client.
Hope this helps someone.






