Tag Archives: windows

How to Change the Remote Desktop Port in Windows Server 2008 R2 Tips, Tricks and Tutorials 09 APR 2015

As convenient as staying with default ports for services on your server is, the sad truth is that thanks to attackers this is probably not such a good idea.

In order to change the listening port for Remote Desktop connections on your Windows Server 2008 R2 instance, you’ll need to first edit the registry and then allow the change in through the firewall.

The steps are as follows:

  1. Start Registry Editor (Start -> Run -> Type ‘regedit’ -> Enter)
  2. Locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp\PortNumber
  3. On the Edit menu, click Modify, and then click Decimal.
  4. Type the new port number, and then click OK.

Then, if you are running a firewall, you’ll need to add an exception for your newly selected port so that traffic over it is indeed allowed. To do this:

  1. Go to Windows Firewall with Advanced Security >> Inbound Rules >> New Rule >> Enter port number >> Next >> Next >> Done

With all the values changed and the new firewall rule in place (very important if you are doing this with a machine that you don’t actually have physical access to!), close the registry editor and restart/reboot the server.


container ship docked at sydney container port

(And if you are working remotely, then enjoy the agonizing wait before you can try to connect again all while hoping that you did everything correctly first time around! Stressful to say the least.)

Windows: How to Get your Laptop’s Serial Number and Model Name Tips, Tricks and Tutorials 08 AUG 2014

20091016-Windows-Command-PromptMost big name laptops and desktops all have serial numbers and model names, useful bits of information when looking up tech assistance. This information is usually printed on stickers and placed somewhere on either the bottom or the back of the device, but as we all know, stickers aren’t exactly the most permanent of solutions three or four years down the line.

If you are running Microsoft Windows (tested on Windows 7, Fujitsu Lifebook A Series laptop), and have lost your serial number or want to find out the model name, open up a command prompt (search for and execute cmd.exe in the Windows start menu).

With your DOS prompt now open, run:

wmic bios get serialnumber

This will retrieve your laptop’s serial number. To get the product name, run:

wmic csproduct get name

Useful to remember.

For interest’s sake, the heavy lifting is being done by Windows Management Instrumentation Command-line (WMIC), which uses the power of Windows Management Instrumentation (WMI) to enable systems management from the command line. See the related link for more info.

Related link: http://technet.microsoft.com/en-us/library/bb742610.aspx

Windows 7: Manage Startup Programs Tips, Tricks and Tutorials 12 FEB 2014

The recommended way to manage which applications load on start in Windows 7 is of course to trawl through each application’s settings or options pages and control them from there. However, another more efficient way to do it (if you are a little computer literate) is to simply make use of the standard Windows System Configuration tool.

Launch the Microsoft utility by hitting the start button and entering ‘msconfig’ (without the quotes) into the search/run bar. Launch the msconfig.exe executable and navigate to the Startup tab.

There you’ll have a nice listing of all commands currently set to launch on start (registry entries basically), and can then manually trawl through the listing and deselect all the crapware and unnecessary loaders lurking there. (Make use of the Manufacturer and Command items to make sure you’re correctly identifying things before disabling them). Hit apply and then OK to prompt a machine restart.

(Of course, it is also worth your while to see what Services are running, because more often than not, unnecessary lurkers and loaders may very well be running a service to say for instance, ensure that the application command does in fact get launched. As suggested, the Services tab is managed exactly in the same way as the Startup tab, i.e. do exactly the same thing you just did to disable unwanted services!).


Windows: How to Comment out a Line in a Batch File Tips, Tricks and Tutorials 27 JAN 2014

20091016-Windows-Command-PromptAs a reminder to myself so that I don’t have to Google it each and every time I need to work on a Windows Server (in other words, very seldom), there are three ways of adding comments into batch files (.bat) in Windows.

The first, most recognised way (standards-compliant, documented statement) is by making use of the REM statement. Any line in your batch file that starts with REM (which stands for REMark) is completely ignored by the batch interpreter.

Of course, because the way in which batch files are processed by COMMAND.COM and CMD.EXE, i.e. the batch file is read, the command is executed, and then the batch file is reread in order to execute the next command, rinse and repeat until the end of the file, REM statements do in essence slow down the execution of a batch file – though taking into account today’s processing power, this slowdown is negligible (unless of course your batch file is SUPER long!).

REM Comment - This bat-file moves all files

At this point it might be useful to remind yourself that by default the batch interpreter will print out each command before it is processed. Since REM commands don’t do anything, it’s safe to print them without any side effects. If however you want to avoid printing a command, including the REM statement, prefix it with @, or, to apply that setting throughout the program, run @echo off. (It’s echo off to avoid printing further commands; the @ is to avoid printing that command prior to the echo setting taking effect.)

The second way of commenting out a line in a batch file is by utilizing a clever trick that in essence has you converting your comment line into a label by prefixing it with a double colon (::). The first colon tells the batch interpreter that the following text is a label, while the second colon invalidates the label status but then forces the interpreter to still treat the line as a label anyway. This trick has the advantage of not slowing down the interpreter because it doesn’t have to stop to interpret the command statement like it has to for a REM statement – it simply jumps to the next line of the file without having to first reread the whole file again!

:: Comment - This bat-file moves all files

However, this trick does not allow you to start a comment mid line as labels always start at the first non-whitespace character in a command line. Also, code blocks are a pitfall for this trick as commands grouped by parentheses are interpreted as a single command line by the batch interpreter, which then obviously invalidates our ‘fake’ label as just mentioned above – your comment most likely won’t be sitting at the start of the concatenated command line!

Finally you can write multiple lines of comments (or comment blocks) by making use of the ability to jump over your lines of comment using the GOTO statement. In practice:

GOTO EndComment
Comment - This bat-file moves all files
Line 2 - Written by Craig
Line 3 - 2014-01-27

Note, it is probably a good idea to help others understand what is going on by using a descriptive GOTO label name.

And there you go, three different ways of adding comment lines into your .bat batch file.

Related Link: http://www.robvanderwoude.com/comments.php

Tech Tip: Retain your windows desktop environment on any device (PC/Mac/Linux/Android/iOS) by remote accessing your citrix xendesktop from CloudDesktopOnline at an unbelievable citrix xendesktop pricing. To enhance your experience with desktop in the cloud try out dedicated GPU hosting from Apps4Rent to fulfill your graphics requirements.

How to Delete a Folder using the Windows Command Line Software & Sites 30 MAY 2013

blue-folder-iconIf you find yourself stuck in the Windows Command line environment and have an itching desire to delete some of your folders, here is the command to do it: RMDIR.

If like me you are one of the older guys reading this, then you would probably have fingered the old (DOS) DELTREE as the command to use, but seeing as this was technically replaced ages ago, the correct answer is in fact RMDIR, which is responsible for removing a directory (and with switches, an entire directory tree, folders, files and all!).

Given a folder called ‘annoying’, you can banish it by running:

rmdir c:\annoying

Of course this will fail if ‘annoying’ isn’t empty. To get around this and delete the entire directory tree, in other words a recursive file and folder delete, we employ the /s switch:

rmdir /s c:\annoying

And if we don’t want to be prompted or bothered again by what is about to happen, we force the command into quiet mode with the /q switch:

rmdir /s /q c:\annoying


Related Link: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/rmdir.mspx

How to Map a Drive Letter to a Folder in Windows Software & Sites 25 FEB 2013

Although it is relatively easy to assign a drive letter to a physical or removable drive, or to a network path for that matter, it isn’t quite as obvious how one goes about mapping a drive letter to a folder in Windows.

Funnily enough, this ability has existed in Windows via the subst command for quite a while now, going all the way back to Windows XP!

If you are a keyboard ninja then you would of course jump straight to a command line and start banging away with the subst command, but for the rest of us out there the easiest method by far is to make use of a simple utility called Visual Subst, which gives you a nice graphical interface to assign drive letters, but also does something that the command line version can’t – you can set your virtual drives to apply again at startup.

Once you’ve downloaded the utility, simply run it, use the browse button to select the path you want to map to, and click the green plus symbol to choose enforce the chosen drive letter.

As simple as that. If you want to save your mapping so that it is more permanent, hit the “Apply virtual drives on Windows startup” option.


Related Link: http://www.ntwind.com/software/utilities/visual-subst.html

How to Share a Printer to a Windows PC from an Ubuntu PC CodeUnit 07 OCT 2011

Sharing a printer to your Windows laptop or desktop PC from your main Ubuntu desktop machine is made pretty simple thanks to the magic of Samba. Here’s a quick tutorial on how to efficiently share your printer under Ubuntu then:

First, install Samba via the Ubuntu Software Center. (Search for ‘Samba’. That tends to work!)

Next access the properties sheet of the printer which is connected to your system that you wish to share. (System -> Administration -> Printing. Right click on the printer icon and select ‘Properties’).

Select ‘Policies’ on the left menu and check the boxes shown below. (Tick ‘Enabled’, ‘Accepting Jobs’ and ‘Shared’)

Next, click on the ‘Server’ menu option on the Printing dialog and select the ‘Settings’ submenu.

Again, check the boxes shown below: (Tick ‘Show printers shared…’, ‘Publish shared printers…’ and ‘Allow printing from…’)

To make it easy to access the now shared printer from your other systems, you need to make it discoverable. A quick way of doing that is to press Alt+F2 on the keyboard and run:

gksu gedit /etc/samba/smb.conf

Scroll down the file to the Printers section and change the ‘browseable’ value to yes. Save the file and if you are not feeling so confident in restarting services on your machine, restart the whole computer.

Now that the printer is shared on your Ubuntu machine, let’s access it on your Windows laptop.

Access the Printers dialog found in the Control Panel and select the menu option to add a new printer. When prompted, select ‘Add a network, wireless or Bluetooth printer’.

If both your systems happen to be in the same workgroup, then Windows will automatically locate the printer for you and you simply click on it to add. If they aren’t in the same workgroup, then you need to specify the path to the printer yourself.

And that’s it. Nifty, eh?

Windows Keyboard Shortcut: Quick, Launch the Task Manager! CodeUnit 11 JUL 2011

Here’s a nifty Windows keyboard shortcut which I was not aware of until recently. My version of Vista tends to freeze a lot, meaning a lot of sluggish trips through to the Open Task Manager button on the Control+Alt+Delete screen. However, with this particular keyboard shortcut, you can launch Task Manager directly, which is pretty awesome if your machine is about to keel over and you don’t want the poor thing struggling to draw new and unnecessary windows!

To launch, simply press Control+Shift+Escape, which will quick launch task manager in the blink of an eye.


PHP: Handle Microsoft Windows Smart Quotes in Your Strings CodeUnit 04 JUL 2011

Microsoft Word likes converting single and double quotes into it’s so-called smart quotes representation, which can be annoying when you are trying to display the string on a device that doesn’t support smart quotes (the curly ones in case you were wondering). The easiest way to clean out these curly smart or fancy quotes is to run a simple search and replace on your string:

 $text = "string containing Microsoft Smart Quotes...";
 $chrs = array (chr(150), chr(147), chr(148), chr(146));
 $repl = array ("-", """, """, "'");
 $text = str_replace($chrs, $repl, $text);

And now you know.