Technology Tales

Adventures & experiences in contemporary technology

Using PowerShell to reinstall Windows Apps

9th September 2016

Recently, I managed to use 10AppsManager to remove most of the in-built apps from a Windows 10 virtual machine that I have for testing development versions in case anything ugly were to appear in a production update. Curiosity is my excuse for letting the tool do what it did and some could do with restoration. Out of the lot, Windows Store is the main one that I have sorted so far.

The first step of the process was to start up PowerShell in administrator mode. On my system, this is as simple as clicking on the relevant item in the menu popped up by right clicking on the Start Menu button and clicking on the Yes button in the dialogue box that appears afterwards. In your case, it might be a case of right clicking on the appropriate Start Menu programs entry, selecting the administrator option and going from there.

With this PowerShell session open, the first command to issue is the following:

Get-Appxpackage -Allusers > c:\temp\appxpackage.txt

This creates a listing of Windows app information and pops it into a text file in your choice of directory. Opening the text file in Notepad allows you to search it more easily and there is an entry for Windows Store:

Name                   : Microsoft.WindowsStore
Publisher              : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture           : X64
ResourceId             :
Version                : 11607.1001.32.0
PackageFullName        : Microsoft.WindowsStore_11607.1001.32.0_x64__8wekyb3d8bbwe
InstallLocation        : C:\Program Files\WindowsApps\Microsoft.WindowsStore_11607.1001.32.0_x64__8wekyb3d8bbwe
IsFramework            : False
PackageFamilyName      : Microsoft.WindowsStore_8wekyb3d8bbwe
PublisherId            : 8wekyb3d8bbwe
PackageUserInformation : {S-1-5-21-3224249330-198124288-2558179248-1001
IsResourcePackage      : False
IsBundle               : False
IsDevelopmentMode      : False
Dependencies           : {Microsoft.VCLibs.140.00_14.0.24123.0_x64__8wekyb3d8bbwe,
Microsoft.NET.Native.Framework.1.3_1.3.24201.0_x64__8wekyb3d8bbwe,
Microsoft.NET.Native.Runtime.1.3_1.3.23901.0_x64__8wekyb3d8bbwe,
Microsoft.WindowsStore_11607.1001.32.0_neutral_split.scale-100_8wekyb3d8bbwe}

Using the information from the InstallLocation field, the following command can be built and executed (here, it has gone over several lines so you need to get your version onto a single one):

Add-AppxPackage -register “C:\Program Files\WindowsApps\Microsoft.WindowsStore_11607.1001.32.0_x64__8wekyb3d8bbwe\AppxManifest.xml” -DisableDevelopmentMode

Once the above has completed, the app was installed and ready to use again. As the mood took me, I installed other apps from the Windows Store as I saw fit.

Forcing an upgrade to Windows 10 Anniversary Update

6th September 2016

There remain people who advise those on Windows 7 or 8.x to hold fire on upgrading to Windows 10. Now that the free upgrade no longer is available, that advice may hold more weight than it did. Even so, there are those among us who jumped ship who do not mind having the latest versions of things at no monetary cost to see what is available and I must admit to being one of those.

After all, I do have a virtual machine with a pre-release version of the next update to Windows 10 installed on there to see what might be coming our way and to get a sense of what changes that may bring so that I am ready for those. Otherwise, I usually am happy to wait but I noticed that the Windows 10 Anniversary Update only came to my HP Pavilion dm4 laptop and not other machines with Windows 10 installed so I started to wonder why there was a lag when it came to automatic upgrades.

So that these things do not arrive when it is least convenient, I took advantage of a manual method in order to choose my timing. This did not involve installation from a disk image but was in-situ. The first part of the process is standard enough in that the Settings app was started and the Update & security item chosen. That dropped me onto the Windows Update and I first clicked on the Check for updates button to see what would happen. When nothing came of that, the Learn more link was clicked to bring me onto part of the Microsoft support website where I found that the Windows 10 Anniversary Update installer could be downloaded so I duly did just that.

Running it produced a screen asking whether or not I wanted to proceed. Since I wanted to go ahead, the appropriate button was clicked and the machine left alone until the process complete. Because the installer purely is a facilitator, the first stage is to download the rest of the files needed and that will take a while on any connection. Once downloading was completed, the actual process of installation commenced with several restarts before a log-in screen was again on offer. On logging in to the machine, the last part of the process started.

The process took quite a while but seemingly worked without a hitch. If there was anything that I needed to do, it was the re-installation of VirtualBox Guest Additions to restore access to shared folders as well as dealing with a self-inflicted irritation. Otherwise, I have found that previously installed software worked as expected and no file has been missed. Waiting a while may have had its advantages too because initial issues with the Anniversary Update will have been addressed but it is best not to leave it too long or you could have the feeling of being forgotten. A happy balance needs striking.

Dealing with an “Your insider preview build settings need attention” message in Windows 10 Settings

5th September 2016

Fix-Your-Insider-preview-build-settings-need-attention_560

Having now upgraded all my Windows 10 machines to the Anniversary Update edition without much in the way of upheaval, I came across the following message on one of them:

Your insider preview build settings need attention. Go to Windows Insider Programme to fix this.

It appeared on the Update screen of the Settings application and I believe that I may have triggered it by letting foolish curiosity take me to the Windows Insider Programme screen. Returning there offered no way of resolving the issue so I had to try the registry editing tip that I discovered elsewhere on the web. Naturally, the creation of a System Restore Point before proceeding with changes to the Windows Registry is advised.

Typing REGEDIT into Cortana brings up a clickable link to the Registry Editor. Having clicked on this, I then clicked on the Yes button on the ensuing dialogue box that Windows 10 throws up every time you make a system change such as installing new software. With the Registry Editor opened, I made my way to the following location:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\UI\Strings

Once there, I deleted every entry that mentioned “Insider” or “Windows Insider” to leave only two afterwards: "(Default)", "UnknownErrorDialogValues". That resolved the issue and I now intend to stay away from the Windows Insider Programme screen in Settings so that the message never appears again.

Getting rid of Windows 10 notifications about disabling start-up applications

20th May 2016

On several Windows 10 machines, I have been seeing messages appearing in its Action Centre pane with the heading Disable apps to help improve performance. It appeared again recently so I decided to look further into the matter.

What I found was that the solution first involves opening up Control Panel and that takes a little finding in Windows 10. You could use Cortana to get to it or right clicking on the Start Menu and left clicking on the Control Panel menu. Using the Windows key + X will produce the same menu and choosing the same entry will have the same effect.

Once Control Panel is open, it makes life a little easier if you change to the Large icons view using the drop-down menu under the Search Control Panel box on the right hand side. Then, what you need to do is click on the Security and Maintenance icon.

Once in that Security and Maintenance section, you are presented with two subheadings, one for Security and one for Maintenance. So long as you have not dismissed the message in the action centre, you will see a corresponding entry under the Maintenance section. At the bottom of that entry, there will be a link that turns off these messages permanently and clicking on this will have the desired effect.

Compressing a VirtualBox VDI file for a Windows guest running on a Linux Host

11th February 2016

Recently, I had a situation where my the VDI files for my Windows 10 virtual machine expanded in size all of a sudden and I needed to reduce them. My downloading maps for use with RouteBuddy may have been the cause so I moved the ISO installation files onto the underlying Linux Mint drives. With that space, I then set to uncovering how to compact the virtual disk file and the Sysinternals sdelete tool was recommended for clearing unused space. After downloading, I set it to work in a PowerShell session running on the guest operating system from its directory using the following command:

.\sdelete -z [drive letter designation; E: is an example]

From the command prompt, the following should do:

sdelete -z [drive letter designation; E: is an example]

Once, that had completed, I shut down the VM and executed a command like the following from a bash terminal session:

VBoxManage modifyhd [file location/file name].vdi --compact

Where there was space to release, VDI files were reduced in size to return more disk space. More could be done so I will look into the Windows 10 drives to see what else needs to be moved out of them.

Killing Windows processes from the command line

26th September 2015

During my days at work, I often hear about the need to restart a server because something has gone awry with it. This makes me wonder if you can kill processes from the command line like you do in Linux and UNIX. A recent need to reset Windows Update on a Windows 10 machine gave me enough reason to answer the question.

Because I already knew the names of the services, I had no need to look at the Services tab in the Task Manager like you otherwise would. Then, it was a matter of opening up a command line session with Administrator privileges and issuing a command like the following (replacing [service name] with the name of the service):

sc queryex [service name]

From the output of the above command, you can find the process identifier, or PID. With that information, you can execute a command like the following in the same command line session (replacing [PID] with the actual numeric value of the PID):

taskkill /f /pid [PID]

After the above, the process no longer exists and the service can be restarted. With any system, you need to find the service that is stuck in order to kill it but that would be the subject of another posting. What I have not got to testing is whether these work in PowerShell since I used them with the legacy command line instead. Along with processes belonging to software applications (think Word, Excel, Firefox, etc.), that may be something else to try should the occasion arise.

Resolving Windows Update Error 0x80244019 on Windows 10

21st August 2015

In Windows 10, the preferred place to look if you fancy prompting an update of the system is in the Update & Security section of the Settings application. At the top is the Windows Update and the process usually is as simple as pressing the Check for updates button. For most of the time, that has been my experience but it stopped working on my main Windows 10 virtual machine so I needed to resolve the problem.

Initially, going into the Advanced Options section and deselecting the tick box for Give me updates for other Microsoft products when I update Windows helped but it seemed a non-ideal solution so I looked further. It was then that I found that manually resetting a system’s Windows Updates components helped others so I tried that and restarted the system.

The first part of the process was to right-click on the Start Menu button and select the Windows PowerShell (Admin) entry from the menu that appeared. This may be replaced by Command Prompt (Admin) on your system on your machine, but the next steps in the process are the same. In fact, you could include any commands you see below in a script file and execute that if you prefer. Here, I will run through each group in succession.

From either PowerShell or the Command Prompt, you need to stop the Windows Update, Cryptographic, BITS (or Background Intelligent Transfer Service) and MSI Installer services. To accomplish this, execute the following commands at a command prompt:

net stop wuauserv
net stop cryptSvc
net stop bits
net stop msiserver

With the services stopped, it is then possible to rename the SoftwareDistribution and Catroot2 folders so you can refresh everything to remove them. To accomplish this, execute the following pair of commands using either PowerShell or the Command Prompt:

ren C:\Windows\SoftwareDistribution SoftwareDistribution.old
ren C:\Windows\System32\catroot2 Catroot2.old

Once you have the folders renamed, then you can start the Windows Update, Cryptographic, BITS and MSI Installer services by executing the following commands in either PowerShell or the Command Prompt:

net start wuauserv
net start cryptSvc
net start bits
net start msiserver

Once these have completed, you may close the PowerShell or Command Prompt window that you were using and restart the machine. Going into the Update & Security section of the Settings tool afterwards and pressing the Check for updates button now builds new versions of the folders that you renamed and this takes a little while longer than the usual update process. Otherwise, you could let your system rebuild things in its own time. As it happens, I opted for manual intervention and all has worked well since then.

Creating soft and hard symbolic links using the Windows command line

19th August 2015

In the world of UNIX and Linux, symbolic links are shortcuts but they do not work like normal Windows shortcuts because you do not jump from one location to another with the file manager’s address bar changing what it shows. Instead, it is as if you see the contents of the directory at another quicker to access location in the file system and the same sort of thinking applies to files too. In some ways, it is like giving files and directories alternative aliases. There are soft links that point to the name of a given directory or file and hard links that point to actual files or directories.

For a long time, I was under the mistaken impression that such things did not exist in Windows until I came across the mklink command, which came with the launch of Windows Vista at the start of 2007. While the then new feature may not be an obvious to most of us, it does does that Windows did incorporate a feature from UNIX and Linux well before the advent of virtual desktops on Windows 10.

By default, the aforementioned command sets up symbolic links to files and the /D switch allows the same to be done for directories too. The /H switch makes a hard link instead of a soft link so we get much of the functionality of the ln command in UNIX and Linux. Here is an example that creates a soft symbolic link for a directory:

mklink /D shortcut target_directory

Above, shortcut is the name of the symbolic link file and target_directory is the destination to which it links. In my experience, it works best for destinations beyond your home folder and, from what I have read, hard links may not be possible across different disks either.

Windows commands for setting default applications for opening certain file types

18th August 2015

On Friday, I was working on a system where a session is instantiated from a stored virtual machine that produces a fresh session every time so all previous changes get lost. What I have is a batch script that I run to reinstate what I need and I encountered another task that I wanted it to do.

Part of my work involves the creation of plain text files with the extension lst and this is getting associated with SAS instead of Notepad. While you can reassign such associations using the GUI, it would be nice to do it via the command line too so the assoc and ftype commands caught my interest. The first of these associates a file with a given extension with a desired file type while the second shows the available file types together with the associated applications that open them. The assoc command also show all the associations that are in place when it is executed with no parameters and the ftype command does the same for file types.

Once you have picked out a file type with the ftype command, then the assoc can be used like the following:

assoc .lst=txtfile

The above associates an extension with a file type. In the this, .lst files are going to get opened by Notepad because of the txtfile association. Though it did not do what I wanted on Friday due to system lockdown, it is good to know that this is possible and that even the Windows command line supports goodies like these.

More thoughts on Windows 10

11th August 2015

Now that I have left Windows 8.x behind me and there are a number of my machines running Windows 10, I have decided to revisit my impressions of the operating system. The first Technical Preview was something that I installed in a virtual machine and I have been keeping an eye on things have developed since then and intend to retain a Windows Insider installation to see what might be heading our way as Windows 10 evolves as now expected.

After elaborating on the all important upgrade process earlier, I am now moving onto other topics. The Start Menu is a big item but there are others as you will see below.

Start Menu

Let’s start with an admission: the prototype Start Menu that we got in the initial Windows 10 Technical Preview was more to my liking. Unpinning all the tiles allowed the menu to collapse back to the sort of width that anyone familiar with Windows 7 would have liked. If there was a setting to expunge all tiles at once and produce this state, I would have been well happy.

It was latter that we got to learn that Microsoft was not about consign the Windows 8 Modern interface entirely to history as many would have wanted. Some elements remain with us such as a Start Menu with a mandatory area for tiles and the ability to have it display full screen. Some are live but this can be turned off on a tile by tile basis and unneeded ones can be removed altogether. It is even possible to uninstall most apps by right clicking on a tile or other Start Menu entry and select the required option from the resulting context menu. For others, there is a command line alternative that uses Powershell to do removals. After this pruning, things were left in such a state that I have not been moved to restore Classic Shell so far.

The Start Menu settings used be in the same place as those for the taskbar but they are found in the new Settings tool. Some are in the Personalisation section and it has its own Start subsection for setting full screen mode or highlighting of new apps among other things. The equivalent Colours subsection is where you find other settings like assigning background colours based on those in a desktop background image, which itself is assigned in it own subsection in the Personalisation area.

Virtual Desktops

Initially, I failed to see the point in how Microsoft implemented these and favoured Virtuawin instead. My main complaint was the taskbar showed buttons for all open apps regardless of the screen in which they are opened. However, that was changed so your taskbar shows different buttons for each virtual desktop, just like the way that Linux and UNIX do things. Switching between desktops may not be as smooth of those yet but the default setting is a move in the right direction and you can change it if you want.

Cortana

This was presented to the world as a voice operated personal assistant like Apple’s Siri but I cannot say that I am keen on such things so I decided to work as I usually do instead. Keyboard interaction works fine and I have neutered things to leave off web searches on Bing to use the thing much in the same way as the search box on the Windows 7 Start Menu. It may be able to do more than that but I am more than happy to keep my workflow unchanged for now. Cortana’s settings are available via its pop-up menu. Collapsing the search box to an icon to save space for your pinned and open applications is available from the Search section of the taskbar context menu (right clicking the taskbar produces this).

Settings

In Windows 8.x, the Control Panel was not the only area for settings but remained feature complete but the same is not the case for Windows 10 where the new Settings panel is starting to take over from it. The two co-exist for now but it seems clear that Settings is where everything is headed.

The Personalisation section of the tool has been mentioned in relation to the Start Menu but there are plenty of others. For instance, the Privacy one is one that definitely needs reviewing and I found myself changing a lot of the default settings in there. Naturally, there are some other sections in Settings that need hardly any attention from most of us and these include Ease of access (accessibility), Time & language, Devices and Network & Internet. The System section has a few settings like tablet mode that may need review and the Update & security one has backup and recovery subsections that may be of interest. The latter of these is where you find the tools for refreshing the state of the system following instability or returning to a previous Windows version (7 or 8.x) within thirty days of the upgrade.

  • All the views that you find expressed on here in postings and articles are mine alone and not those of any organisation with which I have any association, through work or otherwise. As regards editorial policy, whatever appears here is entirely of my own choice and not that of any other person or organisation.

  • Please note that everything you find here is copyrighted material. The content may be available to read without charge and without advertising but it is not to be reproduced without attribution. As it happens, a number of the images are sourced from stock libraries like iStockPhoto so they certainly are not for abstraction.

  • With regards to any comments left on the site, I expect them to be civil in tone of voice and reserve the right to reject any that are either inappropriate or irrelevant. Comment review is subject to automated processing as well as manual inspection but whatever is said is the sole responsibility of the individual contributor.