Strings - a list of characters such as ‘abcd’ – are a common feature of programming or scripting. Sometimes you need to join – concatenate – two or more strings together. This is how PowerShell string concatenation works. First you need to know that strings can be defined with single quotes or double quotes: PS> […]
Archive for August, 2017
PowerShell string concatenation
Posted by: richardsiddaway | August 31, 2017 Comments Off on PowerShell string concatenation |PowerShell operators
Posted by: richardsiddaway | August 31, 2017 Comments Off on PowerShell operators |PowerShell has operators – lots of operators. So many operators that it took us TWO chapters to work through them all in PowerShell in Action, third edition – https://www.manning.com/books/windows-powershell-in-action-third-edition. Here’s how you can discover the PowerShell operators. PS> Get-Help about*operator* Name —- about_Arithmetic_Operators about_Assignment_Operators about_Comparison_Operators about_Logical_Operators about_Operators about_Operator_Precedence about_Type_Operators A quick listing gives us: Arithmetic […]
Comparing AD group membership on EmployeeId
Posted by: richardsiddaway | August 30, 2017 Comments Off on Comparing AD group membership on EmployeeId |Back in this post – http://itknowledgeexchange.techtarget.com/powershell/comparing-group-membership/ I showed how to compare the membership of two groups using Compare-Object. The comparison was based on the samAccountName. A question raised the issue of comparing AD group membership on EmployeeId In the case in particular users have multiple accounts BUT the EmployeeId is correct on all and will […]
PowerShell substrings
Posted by: richardsiddaway | August 28, 2017 Comments Off on PowerShell substrings |PowerShell is all about working with objects but you often have to drop to a lower level and work with properties and their values. Many objects have properties that are strings – a string is one of the standard PowerShell literals – and sometimes you want to extract part of a string – a substring. […]
Further information on PowerShell 2.0 deprecation
Posted by: richardsiddaway | August 25, 2017 Comments Off on Further information on PowerShell 2.0 deprecation |The PowerShell team have provided further information about the deprecation of PowerShell 2.0 https://blogs.msdn.microsoft.com/powershell/2017/08/24/windows-powershell-2-0-deprecation/ One point that didn’t come out is that if you remove PowerShell 2.0 your CIM sessions can all run over WS-MAN. DCOM isn’t required any more – YAY
PowerShell pause – how can you pause a PowerShell script? Two ways come to mind. First if you just want the script to pause for a specified time period then you can use Start-Sleep 1..10 | foreach { $PSItem if ($PSItem -eq 5) { Write-Warning -Message "Starting sleep" Start-Sleep -Seconds 5 […]
PowerShell 2.0 to be deprecated in Windows 10
Posted by: richardsiddaway | August 21, 2017 Comments Off on PowerShell 2.0 to be deprecated in Windows 10 |You’ve been able to install the PowerShell 2.0 engine side by side with the latest version of PowerShell for the last few versions of PowerShell. Not any more. PowerShell 2.0 to be deprecated in Windows 10 Fall Creators update later this year. https://support.microsoft.com/en-us/help/4034825/features-that-are-removed-or-deprecated-in-windows-10-fall-creators-up Presumably this will also apply to Windows Server 2016 which is also […]
PowerShell for loop
Posted by: richardsiddaway | August 20, 2017 Comments Off on PowerShell for loop |Loops are a construction seen in most scripting and programming languages. A loop is used to repeat a set of statements a set number of times or until a specific criterion is met or while a specific criterion is true. In this post I’ll describe the PowerShell for loop. For loops are found in many […]
Create a directory
Posted by: richardsiddaway | August 19, 2017 Comments Off on Create a directory |PowerShell enables you to work with the file system on your machine – one question that often comes up is how to create a directory. When working interactively you can use md PS> md c:\testf1 Directory: C:\ Mode LastWriteTime Length Name —- ————- —— —- d—– 19/08/2017 14:24 testf1 md doesn’t look like a […]
PowerShell foreach
Posted by: richardsiddaway | August 18, 2017 Comments Off on PowerShell foreach |PowerShell has a number of ways to perform a loop – I recently counted seven distinct methods. If you can’t list them all don’t worry one is very esoteric and unexpected. I’ll enumerate them in a future post. For now I want to concentrate on a source of confusion – especially to newcomers to PowerShell […]
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