PowerShell SSH support is available by default in PowerShell v6.0 and later. The big thing for PowerShell v6.0 was SSH based remoting. On Windows 10 / Server 2019 OpenSSH is available as an optional install. On earlier versions of Windows you need to install OpenSSH – https://github.com/PowerShell/openssh-portable The installation instructions are available at https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH […]
Archive for April, 2019
Count is a property on arrays PS> $x = 1..10 PS> $x.Count 10 The same information is available through Length (which is the property in the System.Array class definition) PS> $x.Length 10 If the variable is a scalar you get 1 returned PS> $x = 1 PS> $x.Count 1 With an empty […]
Where-Object options
Posted by: richardsiddaway | April 30, 2019 Comments Off on Where-Object options |You have a few Where-Object options when you want to filter data. Remember that Where-Object filters objects based on property values and Select-Object filters objects based on object position in the pipeline or array as well as filtering properties. The classic way to use Where-Object is to use a filter script PS> Get-Process | […]
Opposing Automation
Posted by: richardsiddaway | April 29, 2019 Comments Off on Opposing Automation |Opposing Automation – no I don’t mean that you should oppose it. The sad fact is that there are very many administrators opposed to automation. Within two hours of starting my last job I was told by my team lead “you’ll never automate anything here”. Needless to say our relationship never really worked after […]
File rename is a topic that seems to keep recurring. The simple answer is that you use Rename-Item PS> Rename-Item -Path C:\test\Newoutdata01.txt -NewName OldData01.txt If for whatever bizarre reason you have a character such as [ in your file name the rename won’t work PS> Rename-Item -Path C:\test\New[outdata02.txt -NewName OldData02.txt Rename-Item : Cannot retrieve […]
What’s new in PowerShell v6.2
Posted by: richardsiddaway | April 27, 2019 Comments Off on What’s new in PowerShell v6.2 |The What’s new in PowerShell v6.2 is available at – https://docs.microsoft.com/en-gb/powershell/scripting/whats-new/what-s-new-in-powershell-core-62?view=powershell-6 – together with the already existing documents for PowerShell v6.0 and v6.1. Its worth reading through the three documents – one each for v6.0, v6.1 and v6.2 to see the whole range of changes in PowerShell core.
CIM_Component class
Posted by: richardsiddaway | April 25, 2019 Comments Off on CIM_Component class |I saw a question about the CIM_Component class and wondered what it was. So I tried it PS> Get-CimInstance -Namespace root\CIMV2 -ClassName CIM_Component | select -f 1 | fl * GroupComponent : Win32_Directory (Name = “<directory path>”) PartComponent : CIM_DataFile (Name = “<file path>”) PSComputerName : CimClass : root/CIMV2:CIM_DirectoryContainsFile CimInstanceProperties : {GroupComponent, PartComponent} CimSystemProperties […]
PowerShell version incompatibilities
Posted by: richardsiddaway | April 20, 2019 Comments Off on PowerShell version incompatibilities |There are incompatibilities between Powershell versions – you can’t use classes in Windows PowerShell v4 and there are differences between Windows PowerShell v5.1 and v6.x. One way to deal with PowerShell version incompatibilities is described in the recent post from the PowerShell team – https://devblogs.microsoft.com/powershell/using-psscriptanalyzer-to-check-powershell-version-compatibility/ I’m not a big fan of tools such as PSScriptAnalyzer as I […]
There are three pairs of file times that are available on files on Windows PS> Get-ChildItem -Path C:\test\Newoutdata01.txt | select *time* CreationTime : 14/04/2019 17:28:41 CreationTimeUtc : 14/04/2019 16:28:41 LastAccessTime : 14/04/2019 17:28:41 LastAccessTimeUtc : 14/04/2019 16:28:41 LastWriteTime : 25/02/2019 17:42:49 LastWriteTimeUtc : 25/02/2019 17:42:49 This is how to modify those times Get-ChildItem -Path […]
Get wireless networks
Posted by: richardsiddaway | April 16, 2019 Comments Off on Get wireless networks |I saw a question on how to get wireless networks which got me thinking about string handling and working with legacy command line utilities. I also wanted to compare the options available in Windows PowerShell and PowerShell Core. First up is a relatively brute force approach. This approach works is relatively easy to understand […]
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