25 June, 2013

PowerShell and C#: Can’t load MSOnline module

Crazy stuff, this PowerShell.

I was doing a C# program that needed to load in a PowerShell module with cmdlets intended for Office365. Even I had installed the x64 version of this module; it never showed up the proper place on the hard disk meaning my program failed to load it. Driven by a post on a forum somewhere on the WWW; I tried the following trick which actually worked to my surprise.

I’m running a x64 OS currently (Win8 Pro).

Copy the folder MSOnline from (1) –> (2) as seen here

1) C:\Windows\System32\WindowsPowerShell\v1.0\Modules\(MSOnline)

2) C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Modules\(MSOnline)

After doing this trick, your x64 bit OS will happily load-in the MSOnline PS module into your runspace in your C# program.

    var iniSS = InitialSessionState.CreateDefault();
new[] { "MSOnline" });

var rs = RunspaceFactory.CreateRunspace(iniSS);

m_PowerShell =
m_PowerShell.Runspace = rs;

SecureString ss = m_PowerShellPwd.ConvertToSecureString();

var connectCmd = new Command("Connect-MsolService");
"Credential", new PSCredential (m_PowerShellUsr, ss));

//add to ps

var err = m_PowerShell.Streams.Error.ReadAll();

19 June, 2013

Manage all shares on PC/Server

When one forgets where to manage all shares (if a folder has been deleted but still exists as a share), it can be deleted here.
Just a point of reference when one forgets where that’s managed (as I did!)


Change (telephone) association in Windows 8

So, I accidently happened to associate the TEL extension in the People application to Lync when I meant to associate it to Skype instead. Unfortunately, having done that it does no longer allow me to change that (or so it appears).

The place to change that association is seen below (or so I discovered).


Change the association here and you are good to go.

iPhone/XCode - not all cases are equal!

This bit me! Having made some changes to an iPhone application (Obj-C); everything worked fine in the simulator. But, when deploying the s...