Category Archives: Windows

Date and Time on the Windows Command Line

What a mess.  All you want to do is insert a timestamp into a file name so as to make it easily organizable.  That ought to be simple, right?


What a mess.  There are two real issues at the heart of this.  First, Windows is deathly afraid of nine characters:

\ / : * ? ” < > |

To Windows, those are the most frightening things imaginable.  Do you feel the fear?!  None of their file systems (from FAT16 to NTFS) can manage files using those characters.  Don’t get me wrong, some of those characters can be problematic in a file name.  Can be.  But this prohibition really gets in the way.  Think about how time is formatted literally everywhere.  And who doesn’t love the value of the question mark…

The second issue is that the content of the DATE variable is inexplicably the result of the region and not independent of the region.  So, if a user changes the date display according to where they are, if they change it from the default, the output of the DATE variable is different and must be parsed differently.  (The same problem exists with the TIME variable and the 24 hour clock.) . Again, unfathomable why anyone would use this as a starting point.

In short, I can’t offer a definitive line of code for giving a file name an up to the second timestamp.  I can only offer a line that may or may not need to be tweaked for a given user.

This is for the default date and time settings:


This allows you to create a command like this:

move file.txt %date:~-4,4%%date:~-10,2%%date:~-7,2%_%time:~0,2%%time:~3,2%%time:~6,2%_file.txt

This slices up the DATE and TIME variables (using ~ and then some basic coordinates) to give a result (with an underscore between the date and the time).  If the user is employing a different date (or time) format you’ll have to play around with the coordinates to grab the correct chunk.  Best of luck.

Go get ’em, tigers!


Store Blocked in Win10 after Upgrade

I updated many (near 50) virtual Win10 machines to the latest release build.  Took about two hours per machine.  At least some of those machines no longer were able to access the Store.

The Store Is Blocked
The Store Is Blocked

I love reading “Check with your IT or system administrator” because that’s me.

Google has a lot of results for 0x80070EC, but including Win10 and Store helped me track down a Registry key location.  Since we have no Group Policy in place concerning the Store, I went ahead and remove the restriction.  You can find the key in question at HKEY_LOCAL_MACHINE –> SOFTWARE –> Policies –> Microsoft –> WindowsStore and it’s called RemoveWindowsStore.

Edit the Registry
Edit the Registry

You want to change that 1 to a 0.

Edit Dword
Edit Dword

No reboot required.  Go Store all you want.


Skype Lacks Win10 Love

Building out new Win10 machines on our network, specifically a master of masters in VMware’s esxi.  Probably this can happen in a bare-metal Win10 installation as well.  I haven’t tested it much beyond what you find here.

I tried installing Skype from the Web.  I suppose there are those who will whine I’m supposed to install it from the Windows Store (or however they have branded their store in Windows 10).  Regardless, since I want to ensure I am getting the full version (and not some stripped down Metro-we-don’t-call-it-that-anymore-and-besides-we-don’t-use-it-but-we-do version) I downloaded and installed from the usual executable.

I tried this and it failed.  I found myself caught in an installer loop.

So exciting to get started…
Fuck Skype Click to Call. Seriously, who does this?
Oh, yes. Just what the doctor ordered. Not!
The Moment of Truth
This looks like the same installer?
Yeah, every time…
Since I have not yet installed using the regular installer successfully, I cannot say whether this is by design.  Which is to say, perhaps Microsoft is attempting to force users to use the installer found in their store.  If this is the case, they are doing a lousy job of communicating this fact.  Regardless I was able to get an installer that worked.

Go get this one instead:

That will work.


How the Application Experience Service Fux Firefox

I have been having this problem on a VM pool replica master.  Don’t worry about what that means if you are not familiar with machine pools (VMware); it’s not important.  The important part is that I was not able to save certain files I was downloading with Firefox to the Desktop.

The download process would proceed as expected up until the end of the download.  Then when Firefox would merge the two files of the download into the single file which was the actual downloaded file, it would fail.  Every time.

I tried running Firefox in its safe mode (no extensions).  Nada.

I tried using Revo Uninstaller to utterly remove all traces of Firefox (as IE, Chrome, and Opera did not have this issue) from the machine.  After rebooting and re-installing Firefox the problem persisted.

Eventually I found an obscure mention of a service called Application Experience.  If that service is disabled, this sort of thing can happen.  I checked my personal VM and found that this service was set to Manual.

So I changed that replica master to Manual and rebooted it.

No problem saving the 64 bit Java installer downloaded through Firefox to the Desktop.

It’s an odd connection.  Hope this helps you too.


Shortcut the Long Way ‘Round

Sometimes you want an application to start when you log into a machine.  In most new versions of Windows you can manage this within the Task Manager, there is a Startup tab.  However, in Windows 2012 R2 there is no such tab in the Task Manager.  Yet you may still wish for one.

Fear not; there is a solution.

If you want to add a startup item for the currently logged-on user only, use this command:


If you’d like something to start for any user which logs in, then use this version instead:

shell:Common Startup

Now normally you can simply drag while holding the Alt key and when you drop you drop a shortcut in that location.  This is true even for the first version of this command above; if you drop into that folder while holding the Alt key, you drop a shortcut into that Startup folder.

However, the Common Startup folder is a dangerous and protected system folder.  You will not be able to create a shortcut in that folder.

And just where do you think you're going?
And just where do you think you’re going?

So I said Yes and then moved that into the Common Startup folder.  I had to confirm I wanted to do it, but it allowed the shortcut to be placed.

World’s smallest hack?  Go MS!


PowerShelling Proper-like

We have started using some cool features in VMware’s Horizon infrastructure which enable us to remotely serve virtual applications.  These applications are being served from a Windows 2012 R2 server.  When install an application to participate in this infrastructure, you must use a special mode called (wait for it) /install, and when you are ready to serve those applications you switch back to the usual mode called (hold tight) /execute.  It’s a very simple PowerShell command.

change user /install

change user /execute

Problem was PowerShell informed me in no uncertain terms that I had to be an administrator to run them.


Who do you think you are?
Who do you think you are?

Only one issue: I am a member of the local Administrators group.

I pushed the turbo button on my brain and it thinked.  I right-clicked on the PowerShell icon and chose Run as Administrator.

Just a bad error message.  No worries here.


Uninstall During Windows SafeBoot

Why this is even an issue is a little beyond me.  It must come up often enough to get others annoyed by it.  You have some piece of software that is crashing your system sufficiently that you are unable to remove it using a regular boot.  So, you boot into Safe Mode.  Only problem is, the installer service is disabled during Safe Mode.


Well, let’s hack the registry a bit and sort that shit.

(Don’t be scared, but do proceed with caution and at your own risk.)

So log into your Windows 10 (or whichever, this ought to work even as far back as, ugh, XP) in Safe Mode (f8 is often useful to get there).  Once you get in you can open the Registry Editor from a command prompt.  Holding down the Windows key and pressing R (Win-R) will open the run dialog; then just type regedit and hit Enter.

Once in the Registry Editor navigate to HKEY_LOCAL_MACHINE—> SYSTEM—> CurrentControlSet—> Control—> SafeBoot—> Minimal and right-click on Minimal.  From the local menu which pops up, you’ll want to choose New —> Key.  Name this new key MSIService.

(I have seen one report where the name MSIService did not work and the user used MSIServer instead.  Try MSIService first and go from there.)

Within the new key, MSIService, right-click on the item called Default and choose Modify from the local menu which pops up; then in the Edit String dialog set “Value data:” to Service.  Click the OK button.

regedit MSIServer
regedit MSIServer

Ok, that gives the system what it needs to be able to run the Windows Installer service during Safe Mode.

(Note: if you are running Safe Mode with networking, you want will to do this same work also under HKEY_LOCAL_MACHINE —> SYSTEM —> CurrentControlSet —> Control —> SafeBoot —> Network, but I haven’t test that.)

Now let’s start that service so you can run your uninstaller (or installer for that matter).

In an Explorer (file browser) window, navigate to This PC (or Computer or My Computer) —> Local Disk (your disk, probably C:) —> Windows —> SysWOW64 (earlier systems it may be in System32) —> services.msc; then right-click on services.msc and choose “Run as administrator” from the local menu which pops up.

Lauch services.msc as an admin
Lauch services.msc as an admin

Now locate the Windows Installer service in Services, right-click on that, and choose Start from the local menu which pops up.

Start the Windows Installer service
Start the Windows Installer service

That’s it.  Go forth and uninstall.


No Fucking with Sophos

We run Sophos on all of our machines at work.  I recently built a Windows 10 machine for one of our developers.  He ran into a problem, however, when he tried to debug the application he was writing.

Sophos was falsely blocking his application with the following error message:

File “C:\Users\[username]\Documents\Visual Studio 2015\Projects\KillerFuckingApp\KillerFuckingApp\obj\x86\Debug\intermediatexaml\KillerFuckingApp.exe” belongs to virus/spyware ‘Mal/DotNet-C’.

Ostensibly a false positive I went to discuss the matter.  It didn’t seem likely that his code shared any code with the known exploit so for shits and giggles I asked him to rename the application anything else to see if Sophos was merely objecting to the name.

Sure enough, once he removed “fucking” from the title, Sophos let things be.

At least Visual Studio wasn’t censoring our fucking developer.

Thanks, Sophos; but, you know, fuck off.


Install AD in Win7

I feel like you used to be able to install AD (Active Directory) through the “Turn Windows features on or off” dialog.  Apparently you must now first download the Remote Server Administration Tools (or maybe it was always that way and I just don’t do it often enough to remember).

Regardless, if you behave like a normal administrator it will give you headaches and will fail.  So I’ll give you the little advice necessary to make this installation go quickly and smoothly.

First go here and download the Remote Server Administration Tools.  I am running Win7 64 bit so I downloaded the 64 bit version.  If you are not sure, download them both and one of them will tell you it’s not compatible.

Ok, unfortunately you can’t just run the installer.  The simplest way to ensure it actually installs (no failure allowed) is to launch it from a command line being run as an administrator.  To do this open the Start menu and type cmd.  When you see cmd.exe, right-click on it and choose “Run as administrator”.

Now you are running the command line with elevated privileges.  Just launch the installer from the command line.  You can do this by merely entering the path and file name and hitting Enter.

I always downoad items to the desktop (since they are easy to locate and they exist as a reminder to delete them when done).  If I were signed into the built-in administrator account that path and file would look like this:


Click through the installation dialog and you will see the Remote Server Administration Tools appearing in your “Turn Windows features on or off” dialog.  I check the following items (checking a parent does not check the children).

  • Role Administration Tools
    • AD DS and AD LDS Tools
      • Active Directory Module for Windows PowerShell
      • AD DS Snap-ins and Command-line Tools
      • Server for NIS Tools
    • AD LDS Snap-ins and Command-line Tools
    • DHCP Server Tools
    • DNS Server Tools
    • Remote Desktop Services Tools

That’s it.  Hope that speeds your day along.


Migrating Your RDP History to a Different Windows 7 Machine

You would think this would be a simple operation.  Migrating my bash history for Cygwin meant moving one file.  But you’d be wrong.  This migration means moving two registry hives, one file, and the contents of one very difficult to locate hidden folder.  Well, at least it can be done.

I began with the RDP client already pinned to my Task Bar.  Your results may vary if you have not done so.  Let’s get started.

First open the registry editor (just type regedit in the Run dialog or in the search box for the Start menu).  Once there navigate to

HKEY_CURRENT_USER —> Software  —> Microsoft  —> Terminal Server Client

In this location you will find two hives called Default and Servers.  Export each of those hives (right-click  —> Export), move them to the new machine, and import them (right-click  —>  Merge).

Then you need your Default.rdp file (and any other .rdp files you may have saved if you’d like).  This is a hidden file located in your My Documents folder.  Migrate that file to your other machine (just copy it into the same location on the destination machine).

Finally locate this hidden folder.  You will not be able to navigate to it in the usual manner, even if you have hidden files enabled for viewing.  Just put this in your Explorer window:


Migrate the entire contents of that folder to your new machine and you will migrate all of your so-called Jump Lists.  If you are already using your new machine and would rather not see certain Jump Lists overwritten, only copy in the unique files.  (I don’t know how to determine which file is which list at this time.)

Now you have all four of those items migrated (two registry hives, one file, and the contents you selected from one folder) just go ahead and restart your machine.  Now you should be all good to go.

I hope this helps you along.