I’ve recorded a short video on how to lock windows machines from the windows command line. Let me know if you found it useful.
I’ve recorded a short video on how to lock windows machines from the windows command line. Let me know if you found it useful.
Over at Chandoo.org’s “Become AWESOME in Excel” blog, a great post on making the printing of reports from large Excel spreadsheets much easier: Printing multiple pages with different layouts using Excel.
This looks interesting: “Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites.It includes base CSS and HTML for typography, forms, buttons, tables, grids, navigation, and more.” via Bootstrap, from Twitter, via Scripting News.
What is a style guide?
A style guide or style manual is a set of standards for the writing and design of documents, either for general use or for a specific publication, organization or field. The implementation of a style guide provides uniformity in style and formatting of a document. See Wikipedia for more.
A List Apart have a style guide that I think is quite usable, such that I now loosely base our own style guide on it for an internal wiki that contains our procedures.
Older post from Joe Chernov on how to write a great online answer (i.e. Quora).
I’ve printed out his post and stuck it to the wall here. The key points he makes are:
I often need to know what the external IP address for a client is. Thus I’ve cobbled together the following script. Simply copy the code below into externalip.cmd and when run from the command prompt it will do two things for you:
@echo off
:: Find out what the External IP address is
:: Create the .vbs file first
Echo Option Explicit >externalipaddress.vbs
Echo Dim http : Set http = CreateObject( "MSXML2.ServerXmlHttp" ) >>externalipaddress.vbs
Echo http.Open "GET", "http://whatismyip.org", False >>externalipaddress.vbs
Echo http.Send >>externalipaddress.vbs
Echo Wscript.Echo http.responseText >>externalipaddress.vbs
Echo Set http = Nothing >>externalipaddress.vbs
:: run the resulting .vbs script and set the enviroment variable
for /f "skip=2 " %%G IN ('cscript externalipaddress.vbs') DO (Set ExternalIP=%%G)
:: Display the enviroment variable
Echo External IP is %ExternalIP%
:: tidy up and remove the temp file
del externalipaddress.vbs /q
Often I need to check windows registry values, for example, to see if an addon is working.
From the Microsoft Windows command line (Start | run | cmd) it is easy to see what value a registry key has:
REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\MS Project\Addins\Mindjet.Mm8MsProject.AddIn.4" /v "LoadBehavior"
In this example above, we see if the Mindjet Mindmanager add-on is loaded or not in Microsoft Project.
Spent the day dealing with an exchange server that had been compromised. As a result, heaps of spam emails were in the exchange mail queue. Manually removing them is a major pain in the rear. Fortunately, others have shared how to clear the Microsoft Exchange mail queue of thousands for spam mails.
Of course prior to doing that, the instructions at this Microsoft KB How to block open SMTP relaying and clean up Exchange Server SMTP queues in Windows Small Business Server is quite helpful in showing how to make sure your exchange server is not an open relay. It also shows how to test if it is an authenticated relay attack that is the problem.
I’m often writing scripts to do stuff. It makes my job easier. I’ve often wanted to be able to script the discovery of registry values in the Windows Registry.
Thus here is a short example on using the vanilla windows command line to find the value of a Windows registry key. From my testing these commands are all present by default in Windows XP, Vista, 7, Server 2003 and Server 2008.
Assume we want to find the Microsoft Windows Common Files directory. Using `Regedit` we can find that here: `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\CommonFilesDir`
So the first thing we want to do is query the registry, we do that with the command line tool `reg` as follows ([more about reg][]):
[more about reg]:http://www.petri.co.il/reg_command_in_windows_xp.htm
“Read up on how to use the reg command for more than just a query”
`reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion /v CommonFilesDir >1.tmp`
This will spit out the following into the text file `1.tmp`:
—
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
CommonFilesDir REG_SZ C:\Program Files\Common Files
—
However, this isn’t of much use in a script. Really, we just want the value of the folder itself, not all the extra info.
So what we do is use the command line tool ‘findstr’ which essentially is a windows regex tool ([more about findstr][]). We use it to do this:
[more about findstr]:http://www.netexpertise.eu/en/windows/findstr-an-alternative-to-grep.html
“Read up on findstr – regex goodness on windows by default”
`findstr /r REG_SZ 1.tmp >2.tmp`
This spits out just the line that contains REG_SZ and puts it into the text file `2.tmp`. Now that we’ve just just the one line, we want to strip the first 32 characters off it. We do this by first setting it as an enviroment variale and then trimming it down using the following two commands ([more on set][]):
[more on set]:http://www.computing.net/answers/windows-2000/use-file-contents-to-set-variables/63174.html
“Using file contents to set enviroment variables”
`set /p CommFiles=<2.tmp`
And then we shorten that ([more on trimming][]):
[more on trimming]:http://www.dostips.com/DtTipsStringManipulation.php
"Read up on using set to trim environment variables"
`set CommFiles=%CommFiles:~32%`
Then we can echo the result to the screen using:
`Echo The Common Files directory is: %CommFiles%`
And here it is all in one easy to copy set:
---
Set CommFiles=C:\Temp
reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion /v CommonFilesDir >1.tmp
findstr /r REG_SZ 1.tmp >2.tmp
set /p CommFiles=<2.tmp
set CommFiles=%CommFiles:~32%
Echo The Common Files directory is: %CommFiles%
—
With a little editing I’m sure that you can turn this to your own uses, pulling out the value of registry keys and using them in script files. You’re not limited to this registry key, you can use it to access all sorts of registry keys.
Please do tell me what uses you put this to.
Enjoy.
This post has been written using [WriteMonkey](http://writemonkey.com/ “Zenware for full screen distraction free writing”) as the text editor. Not only that but I’ve utilised Markdown as the method of text mark-up. All of this has been achieved using WordPress as my CMS, Firefox as my browser and a Firefox plug-in called It’s All Text.
My first impressions are actually good. Although its taken a little setup, I’m actually happy with the result. You see, using WriteMonkey as a text editor is, well, gorgeous. The screen is emptied of all distractions. With typewriter mode enabled, it is a pure joy to use.
Now to get this to work I did the following:
+ [disabled the visual editor](http://digwp.com/2010/06/blogging-in-markdown/ “Article by Chris Coyier on blogging in WordPress with Markdown”) in [WordPress](http://wordpress.org “The official WordPress site”),
+ installed the [It's All Text](https://addons.mozilla.org/en-US/firefox/addon/4125/contribute/roadblock/?src=addondetail “Firefox add-on page for It’s All Text”) Firefox plug-in,
+ installed the [PHP Markdown](http://michelf.com/projects/php-markdown/ “Download page for PHP Markdown”) [plug-in for WordPress](http://wordpress.org/support/topic/160189 “Help getting Markdown working in WordPress”),
+ started writing :)
Not so hard is it? Actually the writing bit is the hardest. But you knew that…
What it now means is that when I begin writing a new post in WordPress, I simple click the little edit button that appears, and WriteMonkey fires up, comes to the foreground and I start writing. To finish up, I press CTRL-Q and I click YES I do want to save it.
So I can whole-heartedly say that it’s worth the effort to setup [WriteMonkey](http://writemonkey.com/ “Zenware for full screen distraction free writing”). Go do it! It feels good.
Of course, now the hard bit is about to start, that is, do more writing.
PS: Only found out about WriteMonkey via [DownloadSquad](http://www.downloadsquad.com/2010/07/23/writemonkey-0-9-9-0-final-version-released-full-screen-text-lov/ “These guys are on the bleeding edge of shiny”)