header image

Archive for March, 2019

Pro Microsoft Hyper-V 2019

Posted by: | March 31, 2019 Comments Off on Pro Microsoft Hyper-V 2019 |

I’ve always maintained that the most important thing about PowerShell is what you can do with it. This is brought out in my book – Pro Microsoft Hyper-V 2019 – https://www.apress.com/gb/book/9781484241158 .   My co-author and I describe how to create and manage a hyper-V environment. We use many PowerShell examples but they’re all in the context […]

under: Hyper-V, PowerShell


Posted by: | March 30, 2019 Comments Off on PSCommandNotFoundSuggestion |

PowerShell v6.2 contains a number of experimental features including PSCommandNotFoundSuggestion The idea of experimental features is to make the use of new features – especially those that may cause breaking changes optional. Feedback can be obtainied and the experimental features can be modified, moved out of the experimental state into the full release or even […]

under: PowerShell v6

PowerShell v6.2 experimental features

Posted by: | March 30, 2019 Comments Off on PowerShell v6.2 experimental features |

I’ve mentioned the PowerShell v6.2 experimental features before.   This blog post from the PowerShell team https://devblogs.microsoft.com/powershell/general-availability-of-powershell-core-6-2/ gives a good overview of the available experimental features.   I’ve already covered the use of the temp drive. The command not found suggestions and implicit remoting batching look like they could be useful.  The abbreviation expansion could […]

under: PowerShell v6


Posted by: | March 30, 2019 Comments Off on Copy-Item |

Copy-Item seems to cause problems for many users.   I’ve written an article on the use of Copy-Item that you may find useful – https://searchwindowsserver.techtarget.com/tip/PowerShell-commands-to-copy-files-Basic-to-advanced-methods

under: PowerShell

PowerShell v6.2 release

Posted by: | March 28, 2019 Comments Off on PowerShell v6.2 release |

The Powershell v6.2 release has just been made available on github – https://github.com/PowerShell/PowerShell/releases   The full release notes aren’t available on the Microsoft documentation yet – they should appear in the What’s New section of https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-6   The release notes on github indicate only one breaking change  – around the –NoEnumerate behaviour in Write-Output   There are […]

under: PowerShell v6


Posted by: | March 28, 2019 Comments Off on Read-Host |

Read-Host enables you to prompt for input for your functions and scripts. For instance I see a lot of examples of this sort of code: $group = Read-Host -Prompt ‘Group Name’ Get-ADGroupMember -Identity $group You should only use Read-Host as a last resort. The correct way to pass data into scripts and functions is by […]

under: PowerShell

Powershell default parameters

Posted by: | March 25, 2019 Comments Off on Powershell default parameters |

The issue Scope issue with Install-Module that I discussed in recent posts is annoying because I know that I’ll forget about it and end up installing in the wrong place and have to uninstall and reinstall. Then I remembered PowerShell default parameters.   By adding the line $PSDefaultParameterValues = @{‘Install-Module:Scope’=’AllUsers’} into my PowerShell v6 profile […]

under: PowerShell v6

Putting user information into computer description

Posted by: | March 22, 2019 Comments Off on Putting user information into computer description |

I was recently asked how to add user information – specifically first and last name – into computer description in Active Directory. First get your user $user = Get-ADUser -Identity FredBrown   Then add the information to the computer’s description Set-ADComputer -Identity W10ProIp -Description “Used by $($user.Givenname) $($user.Surname)”   You need to use the subexpression […]

under: PowerShell and Active Directory

Install-Module in PowerShell v6.2 RC 1

Posted by: | March 21, 2019 Comments Off on Install-Module in PowerShell v6.2 RC 1 |

Further to my last post it appears that Install-Module in PowerShell v6.2 RC1 DOESN’T follow the rules. In an elevated session if the scope parameter ISN’T used it will install to $home\Documents\PowerShell\Modules   The default appears to be CurrentUser regardless.   You have to use -Scope AllUsers if you want it to install in C:\Program […]

under: PowerShell v6

Install-Module Scope parameter

Posted by: | March 21, 2019 Comments Off on Install-Module Scope parameter |

Be aware of the Scope parameter when using Install-Module. The following rules apply: Allusers scope installs to $env:ProgramFiles\PowerShell\Modules CurrentUser scope installs to $home\Documents\PowerShell\Modules NoScope defined: – – For an elevated PowerShell session, Scope defaults to AllUsers – – For non-elevated PowerShell sessions in PowerShellGet versions 2.0.0 and above, the Scope is CurrentUser – – For […]

under: PowerShell v6

Older Posts »