Lose Weight the Tech Way


Honestly, there is no tech way or this diet or that diet. This plan or that plan. There is no secret pill, no purge plan, no nothing. Truth be told there is one healthy way to lose weight and one only.

Eat less, move more and breathe.

That’s it, nothing more or less. The science behind losing the fat C55H104O6 is presented nicely in a Ted Talk, but here’s the paraphrased version:

  • Eat less, your body is forced to break down the fat. I represent that above as it’s molecular structure.
  • Move more, it increases the speed of the breakdown of the fat with heat.
  • Breathe, it’s something we do naturally but with the moving we are increasing how much we breathe and expelling CO2. The CO2 is the largest percentage of the broken down fat in the 90% range.
  • Yes, fat breaks down into CO2, which we exhale with every breath. What about the rest of the 100% that’s not CO2? It is expelled as water in sweat, tears, when you go to the restroom and any other way we expelled water.

Pretty simple isn’t it? You don’t need to buy a book, special meals or even join a gym. You just need to eat less, obviously eating a balanced diet of good food with some food you love that may even be junk food, move more by running, walking, playing a sport and breathe. I will suggest that you will be more successful if you move more with a friend or group of friends.

Have fun saving all the money on books and gym memberships.

Advertisements

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

 

PowerShell: Simple Profile


I’ve read a lot of different posts, articles and listened to any different Power Users tell me how to set up my PS profile. What I have seen is that a lot, if not most people want to trick up their profile adding all kinds of cool things that just increase the load time of the PowerShell console. You can import modules when you need them, you can update help when you need it. You get my point.

I believe simple is better, including just enough to make it work and that’s not much at all. Lets see what I have in my PS profile:

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

Four lines, that’s it, but what do they do?

  1. set-location “Path” Just drops me in my PowerShell folder that all my scripts are in.
  2. $a = (Get-Host).PrivateData sets a variable so that I can change colors by accessing the ChildObject PrivateData to assign a different color to different things in the PS window.
  3. $a.ErrorForegroundColor = “green” uses the $a to add the ErrorForegroundColor so that I can assign it a value of  green. You can do more with assigning cmdlets to variables but that isn’t the lesson here.
  4. cls is because I like a a clean workspace while I work.

That’s my whole profile. Nothing spectacular, or even ingenious. I just want to get working and I hate the RED error messages. Green looks so much better.

green-error