Business

PowerShell: Advanced Profile

Posted on


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”
cls

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.

 

Are You Going to Fail?

Posted on Updated on


Success-Failure-SignI’ve talked about my career and it’s hiccup this past year when I had to get my degree to continue a career path at the ripe old age of 53. Yes, it took almost 38 years to go from graduating High School at 16 through the night classes from ECU at Cherry Point MCAS extension campus to the graduation from SCF in the summer of 2013.

Each step of the way after high school I found an excuse to not reach for great. To not do my best, to not get it done. In fact, lets be honest, I just didn’t want to put in the effort to do it. I was lazy and I will admit it. Working for the Sarasota County School Board I have always given my best. I made it to where I was last year because I had finally decided to work hard and stick with one thing and do it well. I thought that  doing a great job and being the best was good enough, but it wasn’t. I hadn’t paid the price of admittance, which is a college degree. The work, the proof that I could learn, I stayed with it to get the degree and went down the proper path.

When the department reorganized I had to do it. I had to make a decision of whether I wanted to be where I was or if I wanted to just go back to the easy career which was a dead end. Well, I obviously went back to school, took my four courses, made the Presidents List with straight A’s and graduated. I also got a position at the district level that is even more challenging than what I did the last 4 years and I get to tinker with cool technology. As an example, in the last week I worked with coworkers and vendors to finish moving our SharePoint implementation to the Big-IP F5 load balancer. It’s fun, we move a major application that all district employees use everyday from an ISA server implementation to the F5 for authentication and load balancing. I also learned how to code a mobile site, cool stuff!

I cared to follow my dream to do cool things, I didn’t say, “but”, or take the easy way out and take a step back. I am doing “Great.”

Enjoy the video below about Failing to get  that Great Job by Larry Smith from Ted Talks.

All About Caring

Posted on Updated on


I read a lot as time permits. Time does not permit me to write or comment much anymore though. After tonight’s reading and events a few weeks ago I decided to take a few minutes to share.

There are a zillion books, self help magazine articles and the like on how to be a better manager. I have read a few myself and until tonight had not found too much that worked consistently. A lot of things work, but they wore out and fell on deaf ears. Kind of like the sports coach that gets fired because the players tuned out his message. On the other hand, what I read tonight is just plain common sense.

It’s almost the Golden Rule, show your people you care about them and they will start to care about what you say. Until they feel you care they will just nod and smile, then go back to doing it the way they have been. If I want someone to follow me, I need to instill the confidence that I have their back. If I don’t then I will have to work harder, check up more and get less accomplished.

Think about it, don’t you feel the same way about your boss? Even if you are a manager, you have a manager above you. The manager above the President? That would be us and we are also the people below him too. Vicious circle, he needs us to care about him to get reelected and we need him to care about us so that we have a better way of life.

On Fathers Day I will take this one step further. Our children need to know we care about them, that we love them, that we will always be there for them. It doesn’t take much, just a hug or a smile. Just taking the time to listen to them or play Rescue Hero’s.

It’s all about caring.