Here’s how I’d solve the puzzle function get-starttime { [CmdletBinding()] param( [parameter( ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] [Alias(‘CN’, ‘Computer’)] [ValidateNotNullOrEmpty()] [string[]]$computername = $env:COMPUTERNAME ) PROCESS { foreach ($computer in $computername){ $props = [ordered]@{ ComputerName = $computer StartTime = ” ‘UpTime (Days)’ […]
Archive for January, 2016
Scripting Game puzzle – – January 2016
Posted by: richardsiddaway | January 31, 2016 Comments Off on Scripting Game puzzle – – January 2016 |PowerShell Deal of the Day – – 31 January 2016
Posted by: richardsiddaway | January 30, 2016 Comments Off on PowerShell Deal of the Day – – 31 January 2016 |PowerShell in Action, Third Edition is Manning’s Deal of the Day Sunday 31 January 2016 Deal of the Day January 31: Half off Windows PowerShell in Action, Third Edition. Use code dotd013116au at https://www.manning.com/books/windows-powershell-in-action-third-edition PowerShell in Depth, Second Edition is also available as part of the deal Deal of the Day January […]
PowerShell editing options
Posted by: richardsiddaway | January 28, 2016 Comments Off on PowerShell editing options |I’ve used the ISE since it first appeared in PowerShell 2.0 but there are a couple of recent annocements that increase your code editing options ISE previews will become available out of band rather than being tied to WMF/OS releases http://blogs.msdn.com/b/powershell/archive/2016/01/20/introducing-the-windows-powershell-ise-preview.aspx The preview ISE is a module you can download from the PowerShell […]
Get-ADUser has 2 filter parameters. The –Filter takes a PowerShell syntax filter e.g. Get-ADUser -Filter {Name -eq ‘Richard’} The –LDAPfilter takes an LDAP search filter e.g. Get-ADUser -LDAPFilter "(Name=Richard)" Mixing them up will ensure you don’t get the results you want
Rescuing IE favourites
Posted by: richardsiddaway | January 26, 2016 Comments Off on Rescuing IE favourites |I received the new Windows Insider Windows 10 build over the wekend and have just discovered that installing it wiped out my IE favourites – or at least those in folders. I’d copied my favourites to Microsoft Edge when installing Windows 10 so I can copy everything back IE favourites are stored at […]
How do you find the FQDN of the machine you’re using. The simplest way is to combine a couple of environmental variables: PS> "$env:COMPUTERNAME.$env:USERDNSDOMAIN" SERVER02.MANTICORE.ORG If you like using CIM (and who doesn’t) you can try this PS> Get-CimInstance -ClassName Win32_ComputerSystem | >> select @{N=’FQDN’; E={"$($_.DNSHostName).$($_.Domain)"}} >> FQDN —- server02.Manticore.org This could easily […]
CDXML filter parameters
Posted by: richardsiddaway | January 24, 2016 Comments Off on CDXML filter parameters |I was recently asked about adding a filter parameter to a cmdlet created through CDXML. If you’ve not seen it before (see PowerShell and WMI Chapters 18 & 19 from www.manning.com) CDXML allows you to creat ecmdlets by wrapping a WMI class in some simple XML. The resultaing CDXML (Cmdlet Definition XML) is thn […]
WMF 4.0 Updates available downlevel
Posted by: richardsiddaway | January 20, 2016 Comments Off on WMF 4.0 Updates available downlevel |The WMF 4.0 Updates that were released in November 2014 for Windows 8.1 and Windows Server 2012 R2 are now available for: Windows Server 2012 Windows Server 2008 R2 SP1 Windows 7 SP1 You need WMF 4.0 installed to install the update Details from http://blogs.msdn.com/b/powershell/archive/2016/01/19/windows-management-framework-wmf-4-0-update-now-available-for-windows-server-2012-windows-server-2008-r2-sp1-and-windows-7-sp1.aspx
Setting external time source in AD
Posted by: richardsiddaway | January 18, 2016 Comments Off on Setting external time source in AD |The PDC emaulator in the root domain of your AD forest should point to an external time source. For some odd reason the PDC emulator in my lab wasn’t doing that. Easily remedied: ## ## set external time source ## set server type to NTP Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Parameters -Name Type -Value ‘NTP’ Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Config […]
If you follow the PowerShell Team blog – http://blogs.msdn.com/b/powershell/ (and if you don’t you should) you’ll know that the WMF 5.0 RTM downloads were pulled just before Christmas. This was due to a bug that reset the module environment. A comment on the blog – http://blogs.msdn.com/b/powershell/archive/2015/12/23/windows-management-framework-wmf-5-0-currently-removed-from-download-center.aspx – from the team indicates that it’s likely […]
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