header image

Archive for June, 2016

Converting strings to dates

Posted by: | June 9, 2016 Comments Off on Converting strings to dates |

You’ll see many examples of this: PS>  [datetime]’12/25/2016′ 25 December 2016 00:00:00   This works great if the date is in US format – MM/DD/YYYY   For those of us who use different date formats – such as England DD/MM/YYYY – this approach won’t work PS>  [datetime]’25/12/2016′ Cannot convert value "25/12/2016" to type "System.DateTime". Error: […]

under: PowerShell

32 or 64 and/or Administrator

Posted by: | June 8, 2016 Comments Off on 32 or 64 and/or Administrator |

When you run the PowerShell console (or ISE) the default icon runs a 32 or 64 bit version that matches your OS. On a 64 bit machine you have the option of running in 32bit (icons have a (x86) suffix on the title.   How can you tell whether you’re running in 32 or 64 […]

under: PowerShell Basics

Local Administrators

Posted by: | June 7, 2016 Comments Off on Local Administrators |

Finding the local administrators on a system is a not infrequent action.  There are a number of ways to do this.   The oldest method is to use the ADSI WinNT provider $group =[ADSI]"WinNT://$($env:COMPUTERNAME)/Administrators, group" $members = @($group.psbase.Invoke("Members")) $members | Foreach {$_.GetType().InvokeMember("Name", ‘GetProperty’, $null, $_, $null)}   NOTE – this doesn’t work on my Windows […]

under: PowerShell

PowerShell Summit 2017–request for topics

Posted by: | June 6, 2016 Comments Off on PowerShell Summit 2017–request for topics |

The PowerShell Summit is a community event. PowerShell.orh may organise it but we’re very aware that it is the PowerShell community’s event.   We’ve been planning the  2017 Summit for a while and we’ve reached a point in the process where we need your help.   What topics would you like to see covered at […]

under: PowerShell, Summit

Dates in file and folder names

Posted by: | June 1, 2016 Comments Off on Dates in file and folder names |

If you want to incorporate the date in a file or folder name you can’t use Get-Date directly PS>  Get-Date 01 June 2016 20:52:03   The simplest answer is to use the –Format or –Uformat parameters: PS>  Get-Date -Format yyyyMMdd 20160601 PS>  Get-Date -UFormat %Y%m%d 20160601

under: PowerShell Basics

« Newer Posts