Monthly Archives: January 2015

Modifying text

I needed to modify some text somewhere in a file. The file looks like this ##  start fileThis is some text. I want to change something. But not this.##  end file I was playing around with various options.  The simplest … Continue reading

Posted in Powershell Basics | 1 Comment

Testing for a hotfix

KB3000850 – the November roll up for Windows 2012 R2 contains some very useful updates. I’ve installed it on some machines in my lab but not all. The update is huge so I’m installing it manually rather than through WSUS. … Continue reading

Posted in CIM, PowerShell and CIM, PowerShell and WMI | Leave a comment

Variable select

I was working on some code that  accesses a SQL database this afternoon. I only needed to pull back a single column from a single row but which column to pull back is variable depending on other data. That’s OK … Continue reading

Posted in Powershell Basics | Leave a comment

WMI errors

Most PowerShell users will have done something like this: £> Get-WmiObject -ClassName Win32_ComputerSystemDomain              : WORKGROUPManufacturer        : Microsoft CorporationModel               : Surface Pro 2Name                : RSSURFACEPRO2PrimaryOwnerName    : TotalPhysicalMemory : 8506093568 Or you can use a computername to access a remote system £> … Continue reading

Posted in PowerShell and WMI | Leave a comment

Unravelling lists of distinguished names

There are a number of AD properties such as MemberOf and directrports that consist of a collection of distinguisednames.  Sometimes you need the  name  of the object rather than the distinguished name: function getname {[CmdletBinding()]param ( [string]$dn) $name = Get-ADObject … Continue reading

Posted in PowerShell and Active Directory | Leave a comment

Filtering on if an AD property exists

There are times when you want to filter the results based on whether a user has an AD property set.  You could do this: Get-ADUser -Filter * -Properties Title | Where Title  | select Name, Title However, that involves pulling … Continue reading

Posted in PowerShell and Active Directory | Leave a comment

Awkward file and folder names

Spent some time today dealing with a situation where there were special characters – namely [ ] in folder a file names £> Get-ChildItem -Path C:\Test     Directory: C:\Test Mode                LastWriteTime     Length Name—-                ————-     —— —-d—-        21/01/2015     17:58            Awkward [One]d—-        … Continue reading

Posted in File system, Powershell Basics | Leave a comment

PowerShell Summit NA 2015 Agenda changes

WE had to make some minor changes to the Summit agenda – the revised schedule is shown on the event web site – http://eventmgr.azurewebsites.net/event/home/PSNA15

Posted in Powershell, Summit | Leave a comment

PowerShell Heroes 2015

Powershell.org has announced the 2015 list of PowerShell Heroes- http://powershell.org/wp/2015/01/17/announcing-our-2015-powershell-heroes/ These are people who have made an outstanding contribution to the PowerShell community but have not been recognised in other ways (such as an MVP award) Please join me in … Continue reading

Posted in Powershell | Leave a comment

Event log dates

You can use Get-EventLog to query the event logs on you system Get-EventLog -LogName System One frequent task is to check if events occurred during a specific timespan. You may feel that you need to use a where-object filter to … Continue reading

Posted in Powershell Basics | Leave a comment