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 […]
Archive for March, 2019
Pro Microsoft Hyper-V 2019
Posted by: richardsiddaway | March 31, 2019 Comments Off on Pro Microsoft Hyper-V 2019 |PSCommandNotFoundSuggestion
Posted by: richardsiddaway | 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 […]
PowerShell v6.2 experimental features
Posted by: richardsiddaway | 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 […]
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
PowerShell v6.2 release
Posted by: richardsiddaway | 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 […]
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 […]
Powershell default parameters
Posted by: richardsiddaway | 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 […]
Putting user information into computer description
Posted by: richardsiddaway | 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 […]
Install-Module in PowerShell v6.2 RC 1
Posted by: richardsiddaway | 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 […]
Install-Module Scope parameter
Posted by: richardsiddaway | 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 […]
Categories
- .NET
- Active Directory
- Architecture
- Azure
- Bash
- BITS
- Books
- CDXML
- CIM
- Cloud
- COM
- Containers
- Deep Dive
- Desired State Configuration
- DevOps
- DHCP
- DNS
- DSC
- European Summit
- Events
- Exchange
- File System
- Firewall
- General
- General IT Matters
- Hyper-V
- IIS
- Infrastructure
- IT Community
- IT Security
- Learning PowerShell
- Linux
- Math
- Microsoft
- Modules
- Nano Server
- Networking
- Office 2010
- Office 2013
- Open Source
- Opinion
- Outlook
- Philosophy
- PowerShell
- PowerShell 7
- PowerShell and .NET
- PowerShell and Active Directory
- PowerShell and CIM
- PowerShell and Exchange 2007
- PowerShell and IIS
- PowerShell and SQL Server
- PowerShell and WMI
- PowerShell Basics
- PowerShell original
- PowerShell Summit
- PowerShell User Group
- PowerShell User Group 2
- PowerShell v2
- PowerShell V3
- PowerShell v4
- PowerShell v5
- PowerShell v6
- PowerShell.org
- PowerShellGet
- PowerShellV2
- PSAM
- Rant
- Registry
- Scripting
- Scripting Games
- Scripting Games 2104
- Security
- SQL Server
- Storage
- Strings
- Summit
- Technology
- Uncategorized
- Virtualization
- Windows 10
- Windows 2012 R2
- Windows 7
- Windows 8
- Windows 8 Server
- Windows 8.1
- Windows Server
- Windows server 1709
- Windows Server 2008
- Windows Server 2008 R2
- Windows Server 2012
- Windows Server 2012 R2
- Windows Server 2016
- Windows Server 2019
- WMFv5
- WPF
- WSUS