The home of Microsoft’s PowerShell documentation is changing from MSDN to https://docs.microsoft.com The PowerShell documentation is currently opened sourced at https://github.com/powershell/powershell-docs This change makes accessing the documentation easier
Archive for July, 2017
PowerShell documentation
Posted by: richardsiddaway | July 31, 2017 Comments Off on PowerShell documentation |Sometimes things just happen and you have to laugh. So I decided I wanted to get back to working with the Windows 10 Insider previews (and Windows Server previews). This time I decided to use VMs rather than my working machine so that interruptions were minimised. I created a new Windows 10 VM and as […]
Unblock and rename files
Posted by: richardsiddaway | July 20, 2017 Comments Off on Unblock and rename files |I have a bunch of files that I’ve downloaded to a specific folder. I need to unblock and rename files in that folder. The rename involves replacing a plus sign with a space. $path = ‘C:\Users\Richard\Downloads\Walks’ $files = Get-ChildItem -Path $path -File foreach ($file in $files) { Unblock-File -Path $file.FullName $newname = $file.FullName […]
Change a computer’s description
Posted by: richardsiddaway | July 16, 2017 Comments Off on Change a computer’s description |The Win32_OperatingSystem class exposes the machines Description. This is how you can easily change a computer’s description. PS> Get-CimInstance -ClassName Win32_OperatingSystem | select Description Description ———– PS> Get-CimInstance -ClassName Win32_OperatingSystem | Set-CimInstance -Property @{Description = ‘Richards Laptop’} PS> Get-CimInstance -ClassName Win32_OperatingSystem | select Description Description ———– Richards Laptop You can see that the description is […]
Control split output
Posted by: richardsiddaway | July 15, 2017 Comments Off on Control split output |In this post I’ll show you show to control split output – that is control the number of strings that are returned. If you use –split with just a delimiter you’ll get a split occurring at every occurrence of the delimiter: PS> ‘SundayJanuary 01 Jan 1 New Years Day First Monday if 1st is Saturday […]
Yesterday I showed how to get the disk, partition and logical disk information using CIM. Today I want to show more diskinfo techniques. This time we’ll use the Storage module which was introduced with Windows 8. Underneath the covers it uses CIM – just different classes. The storage module doesn’t differentiate between volumes and logical […]
Linking disks, partitions and logical drives
Posted by: richardsiddaway | July 11, 2017 Comments Off on Linking disks, partitions and logical drives |A question of the forums was asking about discovering disk information. They were trying to pipe the output of Get-WmiObject into another Get-WmiObject. that won’t work. There is another way. On Windows machines physical drives are divided into 1 or more partitions which are each divided into one or more logical disks. Linking disks, partitions […]
Office holidays are a great thing. They usually occur on public holidays. There’s a web site – www.officeholidays.com – you can use to discover the public holidays in your country. 133 countries are available – http://www.officeholidays.com/countries/index.php. You can also use PowerShell to extract the information $uri = “http://www.officeholidays.com/countries/united_kingdom/index.php” $html = Invoke-WebRequest -Uri $uri $holidays = […]
Variable as a where clause
Posted by: richardsiddaway | July 7, 2017 Comments Off on Variable as a where clause |A post on the forum about using a variable as a where clause looked interesting. What the user wanted to do was to define a variable that contained the filter to be used by Where-Object. As an example consider filtering the output of Get-Service to display only services that are stopped PS> Get-Service | where […]
File name starting with space
Posted by: richardsiddaway | July 5, 2017 Comments Off on File name starting with space |Interesting question on the forum regarding finding files with a file name starting with a space. First problem was creating some files to match the criteria. Renaming in file explorer didn’t work so back to PowerShell PS> Rename-Item -Path C:\test\file1.txt -NewName “C:\test\ file1.txt” PS> Rename-Item -Path C:\test\junk.txt -NewName “C:\test\ junk.txt” Make sure you put 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