Just Released: Gmailer CLI
Out of my home, I’m running a file server (specifically a HP MediaSmart EX485 / Windows Home Server) that runs a weekly, automated backup of all my data to another server off-site via SFTP (WinSCP). What I didn’t have though was an easy way to have an email sent to me containing a simple “success” or “failed” message along with logs of the operation.
Aside from being able to send the email message, there were a couple other requirements that I had:
- It had to be simple and lightweight. I’ve always been a follower of the KISS (keep it simple, stupid) mentality, and there really is no reason to over complicate anything like this. I want it to be easy for myself to use, but as well for anyone else who might need.
- It has to be able to send email using Gmail’s SMTP servers. I don’t have my own SMTP server, and the ones provided by my ISP are severely crippled. Gmail
Well, low and behold, now introducing Gmailer CLI. Feel free to use it, as well as to make any comments or suggestions (it’s only 1.0 after all). I plan on make improvements and adding features over time, so stay posted.
Remove Adobe Drive CS4 Context Menu Item
If you are like me and prefer a minimalist and clean Windows installation, you may be quite annoyed that Adobe Photoshop CS4 will automatically install and create a context menu item for Adobe Drive CS4, regardless if you choose not to install Adobe Drive. This is especially annoying because
- It’s created even if you don’t install Adobe Drive
- You’re not prompted or asked if the menu item should be created
- There’s no easy way of removing it.
From what I’ve found, there are two ways of going about removing it:
- Actually install Adobe Drive CS4, and then uninstall it. This seems to remove the menu item.
- For the more hard core, delete these two registry keys:
- HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers\ {C95FFEAE-A32E-4122-A5C4-49B5BFB69795}
- HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\ {C95FFEAE-A32E-4122-A5C4-49B5BFB69795}
Use Netsh to Change TCP/IP Settings from the Command Prompt
Netsh is a tool that allows you to change TCP/IP settings from the command prompt. You can even make changes to remote workstations that you have access to. Once you learn the basics of scripting with netsh, it’s effortless to make changes (especially when compared to using the GUI and endless windows and dialogs). Netsh has been available in all versions of Windows since the Windows 2000 days.
The things you can do with netsh are pretty extensive, and there’s no way that I can sum them all up here in a simple post. What I will attempt to do though is make mention of a few examples of netsh’s usage, and add more examples in the future. For anything more extensive, the accompanying documentation is fairly decent and can be viewed by using the /? switch.
View TCP/IP Settings
netsh interface ip show config
Set IP Address
Set a static IP of 192.168.1.100, with a subnet of 255.255.255.0 and default gateway of 192.168.1.1.
netsh interface ip set address name="Local Area Connection" static 192.168.1.100 255.255.255.0 192.168.1.1
Obtain IP Address via DHCP
netsh interface ip set address "Local Area Connection" dhcp
Set DNS Server Address
netsh interface ip set dns "Local Area Connection" static 192.168.1.5
Dynamically Obtain DNS Settings
netsh interface ip set dns "Local Area Connection" dhcp
Remote Desktop Connection with Network Level Authentication in XP
It was my understanding that the Remote Desktop Protocol in Windows XP was never going to support Network Level Authentication. Well low and behold, with XP Service Pack 3 you can use the CredSSP Security Service Provider to enable it. The only problem is that in Windows XP, CredSSP is turned off by default.
Turn on CredSSP
- Within the Registry Editor, navigate to the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa subkey.
- Modify the Security Packages value by adding tspkg to the list of packages.
- Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders.
- Modify the SecurityProviders value by adding credssp.dll to the list of providers.
- Restart your computer.
Silently Install CutePDF Writer and Ghostscript
I was quite recently looking to find a way to install CutePDF Writer silently (like most corporate setups) as to keep user interaction to a minimum. Getting CutePDF Writer fully installed consists of intsalling both the writer itself, as well as the GPL Ghostscript. Here’s the fix:
Ghostscript
- Download the Ghostscript converter.
- Rename converter.exe to converter.zip.
- Extract the contents of the zip file.
- Run converter\Setup.exe.
CutePDF Writer
- Download the CutePDF Writer installer.
- Run CuteWriter.exe /verysilent. Using the /silent switch also works, but shows the status of the unattended installation.
Pretty simple. I opted to combine the two into a batch file:
converter\setup.exe cutewriter.exe /verysilent rd "%ALLUSERSPROFILE%\Start Menu\Programs\CutePDF" /S /Q
Export List of File Names with PowerShell
Here’s a quick and easy little function to get a list of files (and their paths) using PowerShell.
Function GetFileNames([string]$path, [string]$outputFile) { $list = Get-ChildItem $path -Recurse $list | Select-Object BaseName, FullName | Export-Csv $outputFile } GetFileNames ".\" "C:\Output.csv"
SSH on Windows Server 2008
Even in this day in age with hightened security throughout it, Windows Server 2008 still lacks a native SSH server. Luckily though, with open source tools such freeSSHd, we can still get the end result. FreeSSHd even has a built-in SFTP server which makes accessing your remote file securely, surprisingly easy.
Install FreeSSHd
Download and install freeSSHd from FreeSSHd.com. The install is pretty straight forward: Run the installer and accept all of the default options. The only exception is to opt to run the SSH server as a service when you are asked.
Add Firewall Rule
A new inbound rule needs to be added to the Windows Firewall in order to allow TCP SSH traffic in on port 22. This can be done either from the Windows Firewall with Advanced Security snap-in or the command line with netsh. The snap-in has a wizard that works great and will walk you through step by step. I prefer the command line with netsh if it’s going to be straight forward with nothing fancy:
netsh advfirewall firewall add rule name="SSH" dir=in action=allow protocol=TCP localport=22
Configure freeSSHd
To configure the freeSSHd server, run the freeSSHd application (either desktop or Start menu shortcuts) as administrator. Not running with administrator rights will result in your changes not being saved.
A tray icon will appear, which will allow you to open the freeSSHd settings dialog. Essentially, it’s just a GUI that makes changes to the FreeSSHDService.ini file (C:\Program Files\FreeSSHDService).
Create a user account for yourself. I didn’t have much luck getting NT authentication working as the authorization mode. I think it may have something to do with UAC being turned on on Server 2008. Selecting Password stored as SHA1 hash worked great though.
Once you’ve created your user accounts, among changing other settings, close the dialog to save the changes. To put the changes into effect though, you’ll need to restart the freesshdservice:
net stop freesshdservice net start freesshdservice
That’s it. You should be all set and ready to test your connection with Putty or some other SSH client.