Skip Ribbon Commands
Skip to main content
 

 Follow Me

 
 
 
 
 

 SharePoint Blog List

 
  
  
  
  
  
  
  
  
  
  
  
  
Todd Klindt's home page > Todd Klindt's Office 365 Admin Blog
What's going on with TK.
July 08
Wrangling Dates and Times with PowerShell

PowerShell does a pretty good job handling dates and times due to its good foundation with .NET and its focus on being cool to use PowerShell users. For basic DateTime formatting the help for Get-Date shows some great, easy to use examples.

help Get-Date –Examples

image

There’s –Format, –UFormat, and –DisplayHint, and those are all before we get to the flexibility that is .tostring(). There’s a lot of options, sometimes it’s too many options. Sometimes trying to string together exact combination of time and date information I’m looking for is a lot of work. Once again, PowerShell is there for me in the form of .GetDateTimeFormats()

(Get-Date).GetDateTimeFormats()

It lists out a collection of precanned DateTime formats you can select from:

image

You can use one of those formats just by selecting its index number:

image

That’s the good news. The bad news is that you have to specify which number you want, and there are 133 formats in the list. If the one that really tickles your fancy is #87 you have to count the lines until you get to it.

Until now.

I had danced this dance a few times, squinting to find that just perfect DateTime format I was looking for and counting the lines leading up to it. Then I put my PowerShell mojo to good use and came up with this little gem:

(Get-Date).GetDateTimeFormats() | foreach {$I = 0} { Write-Host "$I - $_" ; $I++ }

Edit 7/9/2019

A helpful reader suggested this even shinier gem:

(Get-Date).GetDateTimeFormats() | foreach-object -begin {$I = 0} -process {[pscustomobject]@{Index = $I;Value = $_}; $I++ }

This lists each format, along with its index number.

image

Once you’ve found the format of your dreams you can look to its left and see what its index is.

(Get-Date).GetDateTimeFormats()[27]

image

If you want to use it with a variable instead of Get-Date, it looks like this:

image

Now you have no excuses for getting exactly the DateTime format you want.

tk

ShortURL: https://www.toddklindt.com/PoshFormatDateTime

July 02
Renewed as Microsoft MVP, 2019 Edition

Another July 1st, another nervous couple of weeks. Fortunately the news this year was good, I was renewed.

SNAGHTML635de263

Microsoft’s MVP Program is a way that they reward non-Microsoft folks for the contributions they’ve made to the community over the last year. I’ve done enough over the last year to meet that high bar, which is something that I’ve aspired to every year since 2006 when I got my first MVP award.

Being in the MVP Program has been great for me. I have learned so much and made some great lifelong friends. It has been lifechanging.

Congratulations to the other renewed and newly awarded MVPs.

tk

ShortURL: https://www.toddklindt.com/2019MVPAward

July 01
How to Store Windows Credentials with the PnP PowerShell

A few months ago I wrote one of my favorite blog posts, Connecting to Office 365 with Multiple Accounts in PowerShell without Losing Your Damned Mind and I think it’s safe to say that no damned minds have been lost connecting to multiple Office 365 tenants since. A lesser man might have stopped there. He might have felt his mark on the world was made and he might just bask in the glory of all of that love and adoration. Not this guy. Today, I present you an even better way to connect to Office 365 with multiple accounts in PowerShell without losing your damned mind and without loading any additional modules!*

*(as long as you already have the PnP PowerShell module installed, that is)

Between that fateful day and today the delightful folks that work on the PnP PowerShell module have added three cmdlets that work with Stored Credentials, Add-PnPStoredCredential, Get-PnPStoredCredential, Get-PnPStoredCredential.

image

While the PnP cmdlets themselves have been able to pull credentials directly out of the Credential Store you still needed an external module to pull credentials out for use with other modules, namely the Azure AD and MSOnline modules and the SharePoint Online module. I previously met that need with the Credential Manager module. Let’s see how it looks.

Use the Get-PnPStoredCredential cmdlet to retrieve a stored credential by name. I’ve only had it work if I specify the –Type parameter with the PSCredential value.

$creds = Get-PnPStoredCredential -Name MODAdmin -Type PSCredential

You can output the $creds object to make sure it it grabbed the account you expected. Then you can pass that object to another cmdlet, like Connect-AzureAD and use it to authenticate.

Connect-AzureAD -Credential $creds

Here’s how it looks.

image

I haven’t loaded the Credential Manager module since the stored credential cmdlets showed up in the PnP Module. I already have the PnP module installed everywhere, so it seems unnecessary.

Happy Credential Storing.

tk

ShortURL: https://www.toddklindt.com/PoshMultipleAccountsPnP

June 17
Migrating to Office 365 Checklist Blog Post

This is a blog post, about a blog post. Smile I recently published a blog post, “Migrating to Office 365 Checklist” for SysKit and I thought I’d better let all of you, my faithful blog readers know about it too, in case you didn’t see it. SysKit has been publishing a lot of great content in addition to the stuff of mine they’re publishing. Another of my favorites is, “Top 10 Office 365 Best Practices Every Admin Should Know” from Toni Frankola.

Check out my article and let me know what you think.

tk

ShortURL: https://www.toddklindt.com/MigO365Blog

June 04
Podcast 433 - CDXXXIII (Into a Dutch Canal)

Todd and Shane are back together after a few weeks with one or the other or both being away. They talk about all the cool stuff announced at the SharePoint Conference North America. Then they talk a bit about some of their home networking stuff. Lots of fun content.

Audio File

Video File

Podcast 433 - CDXXXIII (Into a Dutch Canal) (Time 0_11_09;01)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 49:26

Links:

Microsoft Search
OneDrive Announcements
SharePoint Home Sites
SharePoint On-Prem in Azure IaaS can use SQL PaaS
Working with complex SharePoint Columns in PowerApps
Microsoft Business Application Summit

ShortURL: https://www.toddklindt.com/Podcast433

June 04
Podcast 432 - Intimate Podcast

Todd runs the show by himself this week. Talks about a few recent announcements from members of the PG for SharePoint Online, some fun stuff to help admins with flow, and then he covers a few announcements made at Build. He talks a little more about the Ubiquiti network configuration and how that works and then wraps with some of the community events.

Audio File

Video File

Podcast 432 - Intimate Podcast (Time 0_20_15;01)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 32:23

Links:

SharePoint Online Can Now Rename Site URLs
Making lists in SharePoint just got easier
Welcome to Microsoft Search
New Fluid Framework
Companion devices to the rescue – Microsoft Teams
Create A Flow That Finds Your Flows
Create A Super Finder Microsoft Flow
SPS Nashville
SPS Charlotte
Microsoft Business Application Summit
PowerScripting Live

ShortURL: https://www.toddklindt.com/Podcast432

May 13
See me at the SharePoint Conference 2019

I can’t believe it’s almost here! The SharePoint Conference 2019 is next week in Las Vegas. If you’re going to be there, and you’d like to hang out here are a couple of events I’ll be at:

Monday May 20th - SharePoint Administrator Day Camp – That joker Shane and I are doing an all-day workshop on SharePoint Administration. There are still seats available. ($500 on top of regular conference registration)

Tuesday May 21st 10:45 – 11:30SysKit Q&A at the SysKit Booth – I’ll be hanging out with my buddies at SysKit chatting about how great Office 365 is, how great the SysKit product line is, and how much we all like chocolate. Swing by, say hi and get some swag.

I’ll also be wandering around spreading good cheer. If you want to catch up email me or tweet me @toddklindt.

See you next week.

tk

ShortURL: https://www.toddklindt.com/SPC2019Meetup

May 10
PowerShell to Update your PowerShell Modules

One of the great things about PowerShell is how easy it is to extend it with modules. The only thing greater is all the modules that are out there. I have a bunch that I use on a daily basis, I couldn’t live without them. But in today’s rapid development cycle it’s easy to get behind on your favorite modules. I wrote this blog post to help people keep up with the Office 365 related PowerShell modules I use, but from what I understand there are other technologies out there with their own suite of modules that people want to keep up with. To help those folks out, I thought I’d share how I keep up to date with my favorite modules.

This method only works with modules that are installed from a repository. If a module has been installed some other way, like with an MSI or EXE you’re out of luck.

The key to this magic is a group of cmdlets that deal with modules, particularly Find-Module and Update-Module. That’s why it only works with modules installed from a repository with Install-Module. To find the relevant cmdlets run:

Get-Command -Noun module

and

Get-Command -Noun InstalledModule

Here’s how I stitch them together to get a list of modules that have updates:

Get-InstalledModule | foreach { $b = (find-module $_.name).version ; if ($b -ne $_.version) { Write-host "$($_.name) has an update from $($_.version) to $b" } }

Let’s break that down.

Get-InstalledModule

Gets all of the modules that have been installed from a repository.

| foreach

Pipes them all l through a foreach loop.

$b = (find-module $_.name).version

Grabs the current published version of the module in the loop.

if ($b -ne $_.version)

Checks to see if the published version is the same as the Version property of the installed module.

{ Write-host "$($_.name) has an update from $($_.version) to $b" }

If they are not equal, it writes out the module name, the installed version, and the current published version.

It looks like this:

image 

In screenshot I ran Get-InstalledModule to show its full output, then the full command and its output.

Now we know which modules can be updated. We can update an individual module like this:

Update-Module SharePointPnPPowerShellOnline –Force

That will update the SharePointPnPPowerShellOnline module and won’t yell at us because it’s replacing an existing one. If the module has been installed with the “AllUsers” scope (the default) you’ll need to run the Update-Module cmdlet in an Administrator prompt.

image 

Now if I run my command it will not report that that the SharePointPnPPowerShellOnline module has an update.

image 

It would be easy to replace the “Write-Host…” part of the command with “Update-Module $_.name” and have it update them automatically. I didn’t do that mainly because the PowerApps modules’ install is a little hinky and requires some extra handholding. If you don’t have them installed, or you want to upgrade them manually first, you could have the command update them automatically.

I hope you’ve found this helpful.

tk

ShortURL: https://www.toddklindt.com/PoshUpdateModules

May 08
Podcast 431 - It's about Time

Todd and Shane are back this week. They start with a few new things in SharePoint, sticky columns and the round-up announcements. There was a lot of talk about cloud security and recent hack announcements. Then they talk about some personal technical challenges with 3D Printing and home networks. Finishing up with the community events and self-promotion.

Audio File

Video File

Podcast 431 - It's about Time (Time 0_00_41;13)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 1:08:12

Links:

Chris's April Round-Up for SharePoint
Hackers went undetected in Citrix's internal network for six months
Edge Chromium added Chromecasting
Cloud Key Gen 2 Plus
Unifi Security Gateway
8 Port switch with POE
2 x AC LR AP (access points)
SPS Nashville
SPS Charlotte
SharePoint Saturday Atlanta
SharePoint Conference NA
Microsoft Business Application Summit

ShortURL: https://www.toddklindt.com/Podcast431

May 06
Podcast 430 - Everything is Shared

In this epic episode, Shane and Todd talk about "kids these days" and the effect they are having on everything from how SharePoint is organized to break new cell phones. Maybe not that dramatic but, you get the idea. Google G Suite is made fun of and Todd sets up his new printer. All of that and more. And if you are into Game of Thrones check out the bonus content at the end where the guys talk about episode 2.

Audio File

Video File

Podcast 430 - Everything is Shared (Time 0_00_26;29)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 1:11:14

Links:

Archive Hub Sites
Google G Suite to Office 365 migration tools
Files restore for SharePoint and Microsoft Teams
Outlook’s Option to End Appointments and Meetings Early
Foldable Phones Fail
PowerApps Attachments
SPS Nashville
SPS Charlotte
SharePoint Saturday Atlanta
SharePoint Conference NA
Microsoft Business Application Summit

ShortURL: https://www.toddklindt.com/Podcast430

1 - 10Next
 

 Subscribe to my Netcast

 

You can watch Shane and I's Cloudy Podcast live every Wednesday Morning at 10:00 am Central US time at http://www.toddklindt.com/Netcast

You can subscribe to the Podcast in the following ways:

MP3 Audio

Windows WMV video

YouTube Channel

 

 SPDocKit

 
 

 Todd's Upcoming Events

 
  
  
There are no items to show in this view of the "Events" list.