PowerShell: Advanced Profile

In my last post almost 6 months ago I spoke about PowerShell profiles, especially how I preferred a simple profile. If you are just doing some simple things that you need right away or aren’t administering an application like Azure, SharePoint or Office365 then you can suffice with the simple profile. Since I manage Office365 and the applications mentioned above I have morphed to a second profile that I now load to load everything that I need for those applications. The time entering my username and password for those accounts, saves on having to load a different PS1 or create a function to do it later. My thoughts about not creating the function is if I do it once the first time I can just continue working without stopping when I need to do something in those applications.

My previous profile looked like this:

set-location c:\Powershell
$a = (Get-Host).PrivateData
$a.ErrorForegroundColor = “green”

Just your basic profile that sets my default location, and sets the color of the evil error message RED to easier to read GREEN on the blue background. Now for my work within all of the applications that I admin this is the profile I use:

set-location c:\PowerShell
$env:path += “;C:\PowerShell”
$host.ui.RawUI.WindowTitle = “Administrator – Sysadmin Mode”
$Shell = $Host.UI.RawUI
$a = (Get-Host).PrivateData
$a.ErrorForegroundColor = “green”
import-module MSOnline
Import-Module AzureAD
Import-Module AzureADPreview
Import-Module ‘C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell’
$cred = Get-Credential
Connect-MsolService -Credential $cred
Connect-AzureAD -Credential $cred
Connect-SPOService -Url https://company-admin.sharepoint.com -Credential $cred

So, that is a lot more involved, but I only interact with the loading of the profile once at the line: $cred = Get-Credential, which is where I enter my credentials for Office365. Obviously our AzureAD is connected to Office365 which includes our SharePoint too so I only need to enter my credentials once.

First a disclaimer: I close this profile shell when I leave the computer even though I lock the computer screen.  This is best practice so that if anyone gains access to my workstation, they do not gain access to my Sysadmin account in PowerShell to do damage. We change our passwords on a regular basis to prevent access as is also best practice, but anything you can do to lower a hackers attack surface the better.

So, what does this all do? Well that is a pretty good question.

  1. I set the default location of my console as my PowerShell folder that contains all my scripts.
  2. I add the PowerShell folder to the system path
  3. Change the title of the shell to let me know I am running in Sysadmin mode.
  4. Set the system shell as the current console
  5. Set the error color to green
  6. Import all the Modules I need to make sure they do get loaded, including the SharePoint Module that is an MSI install
  7. Store my credentials for this session for use logging in
  8. Connect to all the services using the credentials I supplied. The SharePoint SPOService would need you to replace the word “company” with your company name.


I believe that this front end work saves me a lot of time when I have to do something in SharePoint or the SAAS client or AzureAD.


Windows 10 Activation Error code: 0xC004F034

Cortana-in-Windows-10I’m wondering when the major computer vendors are going to have a roll out of a new product and it not kludge on their servers. Every iOS update is pure misery for anyone updating the first few days because of slow or overwhelmed servers. With all the supposed computing power of these companies you would think they would over plan.

Today Windows 10 launched and you guessed it, Activation has not been a smooth process. The error message “Error code: 0xC004F034” ominously says that it can’t read your Registration code or it is invalid. With the Microsoft servers are getting smashed I am guessing that no one decided to add a new error code.

OOPS you got a busy signal

I thought that I saw something on a blog, maybe even a Microsoft blog that they were going to release it via “Check for Updates” to Windows Insiders first. As they did, then it would be a rolling update for all reserved copy users and so on. This would be a great plan if it seemed it worked.

I have already hit the Activation problem with my home computer. With a quick search of the internet you will already find multiple people asking, multiple people giving incorrect answers and some that are correct. In fact there is even a YouTube video of the activation process with the proper answer already. Following the suggestion after watching the video I successfully activated Windows 10. I am adding the video below so you can actually see the activation work, but for those who just want the answer: just keep clicking Activate until it completes. At some point you will get through without the server being busy. It took between 5 to 10 tries for me, mileage varies based on time of day and pure luck.

The Best OS or the Best User Experience, There is a Difference

The Best OS or the Best User Experience, there is a difference.

I just posted in a limited circle a response to a comment about Windows and which is the best OS. I felt the need to share an edited version in my public stream. What is below is in response to a comment that was in response to something I posted to someone who is an expert in the computer field that I respect and in the Windows OS in particular. The other commentor is not the Windows expert, just someone else responding to the original post.

In my original response to the Windows Expert I made the comment that Windows wasn’t the greatest, beat all OS when it was first born. Windows has grown over the years, taken steps backwards (WinME) and half baked releases that should have stayed in the oven until they were ready (Vista which I call Win7 Jr.)

Linux or the Mac OS are not better than Windows as a computer OS. I use them all in my work in K12IT and computer consultant. The easiest to use with the most programs for the end user by far is Windows. It’s the most maligned for a reason, but has gotten better as it has grown. It is also the biggest in terms of end users because Apple decided a long time ago to be proprietary. That decision is what made the WinTel computer the leader in the industry with the Windows OS as it’s main OS. That decision, if it had been different may have changed what everyone considered for their choice of computer. Would you have bought an Apple computer if it had cost what a PC clone did back in the 80’s?

Linux is not a mainstream OS for the average user, never will be because the end user does not like to have to do a lot to get it to work. It needs more user input for setup than Windows does and end users complain about the amount of input they have to give for Windows. That being said, they won’t migrate or use it.

Linux is great for an advanced user that has more defined needs. It is great for tech support and diagnostics. If fact I carry Knoppix on a CD and flash drive that I use more often than not for fixing things. I also have Ubuntu on a Flash and use it as one of my backup servers at home. I do not use it as a basic desktop because I have a wife and children that need to use the computer for themselves.

Macs, I love them. I own an iPhone, my wife uses my old iPhone, a few generations of iPods, a blue iMac laptop and green desktop. I have an old g4 desktop that is also a backup server. I also have a Macbook Air, an iPad 1 and 2. They are all great devices, and what I would consider the best tools for the digital age, but it is overpriced overall for the end user and does not have enough third party products for them. The decision to be proprietary, while making for a better overall product because Apple controlled the show, also made them unaffordable to the general public

They have the best integration with all their devices, but until they bring the prices of their desktops and laptops more in line with the cheaper PC market they will not grow through the single digits in desktop OS market share which OS X has about 7.5% as of August. By tying the iDevices together and making a digital experience I believe that they can move the market, but they should adjust their PC prices to make people switch. If they do, then you will see the rise of Mac and the decline of Windows.

They all have their advantages, disadvantages but Windows is the best OS for the end user because of sheer availability, cost and amount of 3 party products for it.

My preference because of integration for product overall are Apple products, not OS X, Apple’s product line. Until they bring down prices and we have more options on OS X, then Windows will reign as the leader.

from Ray Ebersole – Google+ Post Feed