Category: PowerShell

I've been migrating one of my customers from some older EqualLogic storage area networks to a Nimble SAN. It has all been good with the exception of some problems with VSS (Volume Shadow Copy Service). They use Altaro for backups and from what I've found, Nimble and Altaro don't play well together when it comes to VSS. Nimble's software was installed on the Hyper-V hosts and all three vendors (Nimble, EqualLogic, and Altaro) VSS providers seemed to play well together until volumes were actually moved Read more [...]

It has been a crazy week to say the least. If you're like me, you wanted to make sure that the specific Windows updates that patch the WannaCry ransomware vulnerability have been installed on all of your servers. I've seen a lot of functions and scripts this week to accomplish that task, but most of them seem too complicated in my opinion.
While it's personal preference, I also always think about whether I should use a PowerShell one-liner, script, or function. Usually one-liners are something Read more [...]

This past weekend, I attended the 2017 Atlanta MVP Community Connection. While there, I met fellow Microsoft MVP Allen Underwood who is one of the co-host of the {CodingBlocks}.NET podcast. I listened to their podcast on my trip back home from Atlanta and later discovered that their podcast has an RSS feed for episodes.
A simple PowerShell one-liner can be used to retrieve information about each episode of their podcast:

This past week, I needed to determine if anyone had a PSSession connected to any of the servers that I support. This is fairly easy to accomplish with a PowerShell one-liner, but I can never remember the syntax so I decided to create a reusable function to accomplish the task.

Get-MrRemotePSSession

PowerShell

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

#Requires -Version 3.0

functionGet-MrRemotePSSession{

<#

.SYNOPSIS

Retrieves a list of the Windows PowerShell sessions that are connected to the specified remote computer(s).

Today I thought I would share a one-liner that I recently wrote to query the Manufacturer, Model, and Serial Number information from numerous remote servers. Sounds simple enough, right?
This one-liner starts out by using my New-MrCimSession function to create a CIM session to each of the specified servers. This function automatically determines if the remote server supports the WSMan protocol and falls back to DCom if it doesn't:

I've been working with PowerShell since the version 1.0 days and I'm still amazed that I find cmdlets that I didn't know existed. Back in 2003, I had written some PowerShell code to query group policy for the lockout policy of an Active Directory domain. It used code similar to what's shown in the following example which requires the GroupPolicy PowerShell module that installs as part of the RSAT (Remote Server Administration Tools).

How do you control password resets in your environment? I've worked for numerous companies where their forgotten password reset process was all over the board. Hopefully you have a process in place that allows you to sleep at night. Even with the best policies and procedures in place, what happens when someone on your help desk staff resets a users password to some default password and forgets to set the account so the password has to be changed at next logon? Is the user still using that default Read more [...]

This past Tuesday night, I presented a session on "PowerShell Non-Monolithic Script Module Design" for the Arizona PowerShell Users Group. The video from that presentation is now available.
The presentation begins at 10 minutes and 30 seconds seconds into the video.
https://www.youtube.com/watch?v=XH7ajz3WT0A#t=10m30s
The presentation materials to include the slide deck and code can be found in my presentations repository on GitHub.
µ Read more [...]

This week, I thought I would share a PowerShell function that I wrote to determine what Hyper-V host server a VM (virtual machine) resides on. In this scenario, you have no idea which Hyper-V host a VM resides on.

First off, let me say that this function is written a bit unorthodox.
Typically you'll see functions written where each item in the ComputerName array is iterated through one at a time. Since this function uses the PowerShell remoting Invoke-Command Read more [...]

I recently received an email from someone who attended one of my presentations asking if I had a blog article on using PowerShell to compact and optimize VHD files. Since I didn't have a blog article on that subject, I decided to create one.
The process itself is fairly simple. The examples shown in this blog article are being run on a Windows 10 computer which has Hyper-V enabled on it. Only specific SKU's of Windows 10 are capable of running Hyper-V. The same process can be used on servers running Read more [...]

If you're interested in some free PowerShell training, I'll be presenting two PowerShell sessions at SQL Saturday #593 in Birmingham, Alabama this Saturday, March 18th.
My first one hour presentation begins at 9:40am central time and is geared for beginners. The content covered in this session is based off of a book by the same title that I'm currently writing.
PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell
Interested in PowerShell but not sure how to get started? Already Read more [...]

This morning, I published Chapter 4 of my new book, PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell. The book now contains chapters one through four and is forty percent complete. The book will contain a minimum of ten chapters when it's completed later this year.
Interested, but not ready to commit to purchasing it? Chapter 1 is available as a free download and I've created a video that demonstrates many of the concepts covered in Chapter 1.
If you’re interested in purchasing Read more [...]

Do you blog about PowerShell? If so, consider adding your blog site to Planet PowerShell which is an aggregator of content from PowerShell Community members. There are some guidelines for submission on their GitHub page so be sure to take a look at it before continuing. Instructions for adding your blog also exists on that page, but I've recently seen a number of tweets about it being too difficult or too much work. To be honest with you, if everything in IT was as easy as adding my blog to Planet Read more [...]

Another update to my new book, PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell is now available. The update which was published this morning added chapter 3 to the already available first two chapters.
If you're interested in purchasing this book, consider buying it while it's still a work in progress. The price of the book increases slightly with each chapter that's released.
Chapter 1 of the book is available as a free sample download. There's also a video available which Read more [...]

The new PowerShell cmdlets that are part of the SQLServer PowerShell module that's distributed as part of SSMS (SQL Server Management Studio) 2016 make it super easy to write the output of PowerShell commands to a SQL Server database.
The ActiveDirectory PowerShell module that's part of the RSAT (Remote Server Administration Tools) is also required by the code shown in this blog article.
This PowerShell one-liner retrieves a list of Active Directory users who have not logged in within the past Read more [...]

Links

My Guest Blog Articles

User Groups

Disclaimer

All data and information provided on this site is for informational purposes only. Mike F Robbins (mikefrobbins.com) makes no representations as to accuracy, completeness, currentness, suitability, or validity of any information on this site and will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use. All information is provided on an as-is basis.