Categories

Monthly Archives: August 2012

Add a favourite to Internet Explorer

Way back in this post

http://msmvps.com/blogs/richardsiddaway/archive/2011/06/27/modifying-favourites.aspx

I mentioned about adding a new favourite. 

Favourites are special folders and one way to work with them is through the old COM objects

function add-favourite{             
[CmdletBinding()]             
param(            
[parameter(Mandatory=$true)]            
[string]$name,            
            
[ValidateNotNullOrEmpty()]            
[string]$url            
)            
BEGIN{}#begin             
PROCESS{            
            
$so = New-Object -ComObject Shell.Application            
$ff = $so.Namespace(0x6)            
$path = Join-Path -Path $($ff.Self.Path) -ChildPath "$name.url"             
            
$shell = New-Object -ComObject WScript.Shell            
$sc = $shell.CreateShortCut($path)            
$sc.TargetPath = $url            
$sc.Save()            
            
}#process             
END{}#end            
            
<# 
.SYNOPSIS
Add a new favourite

.DESCRIPTION
Add a new favourite


.EXAMPLE
add-favourite -name mytest -url "http://www.bing.com"

#>            
            
}


The name for the favourite and the URL are parameters. Create a object for the Favourites folder and then a path for the favourite. Use CreateShorcut on the WScript.Shell object add the URL and save

Windows 8 tip: 1 Weather app

The Windows 8 start screen has a nice looking app to display the weather.

You can search for towns and cities to add to the display. My home town (or even the nearest big town) doesn’t show in the results returned by the search. The nearest town I can find is 50 miles away. In England that can be a whole different weather pattern.

On a whim I tried searching for my post code – came up with the correct village and displays.

US zip codes also seem to work.  Haven’t tried for any other countries so can’t guarantee results

Windows 8 Networking cmdlets

Windows 8 brings PowerShell v3 and a whole bunch of PowerShell modules.  One such module is NETTCPIP and as the name suggests is about networking.

PowerShell v3 automatically loads modules for you so as soon as PowerShell opens try

PS> Get-NetIPConfiguration


InterfaceAlias       : Ethernet
InterfaceIndex       : 13
InterfaceDescription : NVIDIA nForce 10/100/1000 Mbps Ethernet
NetProfile.Name      : Unidentified network
IPv4Address          : 10.10.54.202
IPv6DefaultGateway   :
IPv4DefaultGateway   :
DNSServer            : fec0:0:0:ffff::1
                       fec0:0:0:ffff::2
                       fec0:0:0:ffff::3

InterfaceAlias       : WiFi
InterfaceIndex       : 12
InterfaceDescription : Qualcomm Atheros AR5007 802.11b/g WiFi Ada
NetProfile.Name      : TiscaliF23E11
IPv4Address          : 192.168.1.2
IPv6DefaultGateway   :
IPv4DefaultGateway   : 192.168.1.1
DNSServer            : 192.168.1.1

InterfaceAlias       : Bluetooth Network Connection
InterfaceIndex       : 30
InterfaceDescription : Bluetooth Device (Personal Area Network)
NetAdapter.Status    : Disconnected

One thing that you will need to do is to set up PowerShell remoting

PS> Enable-PSRemoting

WinRM Quick Configuration
Running command "Set-WSManQuickConfig" to enable remote management of this computer by using the Windows Remote
Management (WinRM) service.
This includes:
    1. Starting or restarting (if already started) the WinRM service
    2. Setting the WinRM service startup type to Automatic
    3. Creating a listener to accept requests on any IP address
    4. Enabling Windows Firewall inbound rule exceptions for WS-Management traffic (for http only).

Do you want to continue?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): a

Set-WSManQuickConfig : <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2150859113"
Machine="localhost"><f:Message><f:ProviderFault provider="Config provider"
path="%systemroot%\system32\WsmSvc.dll"><f:WSManFault xmlns:f="
http://schemas.microsoft.com/wbem/wsman/1/wsmanfault"
Code="2150859113" Machine="RSLAPTOP01"><f:Message>WinRM firewall exception will not work since one of the network
connection types on this machine is set to Public. Change the network connection type to either Domain or Private and
try again. </f:Message></f:WSManFault></f:ProviderFault></f:Message></f:WSManFault>
At line:69 char:17
+                 Set-WSManQuickConfig -force
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Set-WSManQuickConfig], InvalidOperationException
    + FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.SetWSManQuickConfigCommand

The emphasis of Public is mine. We have a network connection type set to public. At this point I would normally be tearing my hair out because network connection types are the ultimate pain to modify. I have hated the things since Windows Vista. No more they are now a minor inconvenience.

Look in the module NetConnection for Get-NetConnectionProfile

PS> Get-NetConnectionProfile


Name             : Unidentified network
InterfaceAlias   : Ethernet
InterfaceIndex   : 13
NetworkCategory  : Public
IPv4Connectivity : NoTraffic
IPv6Connectivity : NoTraffic

Name             : TiscaliF23E11
InterfaceAlias   : WiFi
InterfaceIndex   : 12
NetworkCategory  : Private
IPv4Connectivity : Internet
IPv6Connectivity : NoTraffic

Now we can get to it modifying is easy

PS> Set-NetConnectionProfile -InterfaceIndex 13 -NetworkCategory Private
PS> Get-NetConnectionProfile


Name             : Unidentified network
InterfaceAlias   : Ethernet
InterfaceIndex   : 13
NetworkCategory  : Private
IPv4Connectivity : NoTraffic
IPv6Connectivity : NoTraffic

Name             : TiscaliF23E11
InterfaceAlias   : WiFi
InterfaceIndex   : 12
NetworkCategory  : Private
IPv4Connectivity : Internet
IPv6Connectivity : NoTraffic

And now you can enable PowerShell remoting

Best of all the change is WMI based.  The netconnection cmdlets are created as CDXML from WMI classes new to Windows 8. Get-NetIPConfiguration is also CDXML.

CDXML is cmdlets over objects – WMI classes wrapped in XML and presented as a module

see Chapters 18 & 19 of PowerShell and WMI for more details

Windows 8 Upgrade experience: #2 Old files

When you do an upgrade or a new install on a system that already has Windows installed you get a Windows.old folder left behind with a whole bunch of stuff you no longer need.

The permissions aren’t reset so you have a painful experience getting rid of it and as its quite a few GB you really do want it gone.

While not insurmountable the problem should never have arisen in the first place

What’s wrong with the Kindle app for Windows 8

A few things really including:

  • If you sign out you lose any downloads!
  • There doesn’t appear to be any way to read kindle format ebooks obtained from other sources. In other words you are locked into Amazon
  • If you sync your settings between Windows 8 systems – seems like a good idea – then only have a single registration for your Windows 8 Kindles
  • Not accessible directly from the Windows desktop

One the plus side it seems to work OK and the reading experience is reasonable, but the inability to read other ebooks means I need yet another ereader. I decided to standardise on the Kindle format for my ebooks – may need to re-think that decision

Overall the Kindle for Windows 8 app is disappointing and a backward step compared to the Kindle for Windows 7 application.

Windows 8 upgrade experience: #1

I’ve upgraded two machines to Windows 8

The first is my main working laptop:

  • Windows 8 Enterprise can’t do an in place upgrade of Windows 7 Ultimate. So had to re-install all my applications. Took the opportunity to upgrade to Office 2013 and Visual Studio 2012
  • Following installed and work:
    • Adobe Digital Editions
    • Camtasia
    • Snaggit
    • Live mail 2012
    • Palm eReader
    • Skype
  • Magic Disk is no longer required because Windows 8 can mount .iso files in the file system.  Right click an .iso file in File Explorer and Mount is the first choice on the context menu
  • Windows defender now does Anti-Virus

 

The second machine was my Dell Duo:

  • Installed windows 8 as an upgrade to Windows 7 Home premium
  • Kindle for PCs doesn’t work on Windows 8. Download the free Kindle app from the Microsoft  store. Its not obvious where the downloaded books are stored
  • The DUO is a hybrid netbook/tablet. The accelerometer stopped working post upgrade meaning the screen didn’t rotate. Not good for a tablet. Dell don’t appear to do an updated driver but a web search found the issue was fixable using the Samsung driver from http://www.samsung.com/global/windowspreview/
  • Running as a tablet swipe & touch all seem to work OK

One draw back to the Kindle app is that it only seems able to access ebooks through the Amazon store. With Kindle for windows PC I could add books in from other sources. Stopping this is a backward step.  Luckily I have other means of reading those ebooks

PowerShell v3 goodness

Downloaded and installed PowerShell v3 and its associated new operating system (Windows 8) from MSDN in the week.

One nice new cmdlet is Unblock-File.

Download a bunch of files from the Internet and you have to unblock them.  Its now this easy

Get-ChildItem -Filter *.d* | Unblock-File