PowerShell Trim – no its not a new slimming fad. Trimming is the act of removing characters – usually white space – from the beginning or end of a string. You have three methods on the String class you can use Trim TrimEnd TrimStart PS> $str = ” abcdefghijk ” PS> $str.TrimStart() abcdefghijk PS> […]
Archive for September, 2017
PowerShell editors
Posted by: richardsiddaway | September 30, 2017 Comments Off on PowerShell editors |PowerShell works great when you use it interactive;y but at some point you’re likely to want to write substantial pieces of code – scripts or functions – for which you’ll need an editor. This is my take on PowerShell editors. There are PowerShell add-ins for Visual Studio – one of the best is PowerShell […]
Call for topics closing 1 October
Posted by: richardsiddaway | September 30, 2017 Comments Off on Call for topics closing 1 October |The call for topics is closing 1 October at 23:59 GMT. We’ve had a fantastic set of submissions. Creating an agenda for the 2018 Summit is going to be very difficult because we’ve had so many fantastic sessions submitted and I don’t have enough slots to take them all. The call for topics is […]
I was incredibly excited when I first saw DSC – it was in April 2013 as a special MVP only preview at the first PowerShell Summit – as a work in progress. Since that time my excitement has waned to the point that I now ask DSC – the future? Looking at the PowerShell […]
PowerShell comments
Posted by: richardsiddaway | September 29, 2017 Comments Off on PowerShell comments |Putting comments into your code has been a long established practice – this is how you do PowerShell comments A single line comment is indicated by the # symbol # This is a comment Get-Process You can put a comment at the end of a line but not in the middle. Once you’ve added […]
Continuous updates expansion
Posted by: richardsiddaway | September 29, 2017 Comments Off on Continuous updates expansion |Microsoft has announced a continuous updates expansion at Ignite Windows 10 was always going to be continually updated rather than new versions introduced. This year Windows Server 2016 joined the party when it was announced that there would be twice yearly updates – Windows 10 moved to the same cadence. At Ignite Microsoft announce that […]
Splitting multiline string
Posted by: richardsiddaway | September 28, 2017 Comments Off on Splitting multiline string |Saw an interesting question on splitting multiline string If you get a set of strings item1 item2 item3 emailed to you then you could put them in a text file and use Get-Content to read them into an array. The question was could you paste them into PowerShell and get the same effect. Not sure […]
PowerShell books DoD
Posted by: richardsiddaway | September 28, 2017 Comments Off on PowerShell books DoD |A number of my PowerShell books including PowerShell in Action and PowerShell in Depth will be part of Manning’s Deal of the Day on 29 September 2017 Use code dotd092917au at http://bit.ly/2hzetVX For DoD details see https://www.manning.com/dotd
Examples of replacing WMI cmdlet with CIM cmdlet
Posted by: richardsiddaway | September 27, 2017 Comments Off on Examples of replacing WMI cmdlet with CIM cmdlet |Following my last post I was asked about these Examples of replacing WMI cmdlet with CIM cmdlet. Example 1 gwmi win32_operatingsystem -computername $Computer -credential $creds, $cs = New-CimSession -Credential $creds -ComputerName $computer Get-CimInstance -ClassName Win32_operatingsystem -CimSession $cs Example 2 get-wmiobject -query “SELECT * FROM Meta_Class WHERE __Class = ‘Win32_Process’” -namespace “root\cimv2” -computername $computer -credential $creds […]
I still see a lot of people using the WMI cmdlets – Get-WmiObject etc. You really should be using CIM nit WMI. In other words use Get-CimInstance rather than get-WmiObject etc etc. Why do I say that? Two main reasons. Firstly, the WMI cmdlets are effectively deprecated. Any further development effort will be for the […]
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