Monthly Archives: October 2012

Create a file name that contains current date, time, computer and user names in Powershell

Set-Content -path  "$env:temp\psr_$($env:computername)_$($env:username)_$(get-date -f "yyyy-MM-dd_HH-mm-ss").txt"  -Value "test content - could have come in from a pipeline instead of a parameter"
  • psr is an arbitrary string ie. could be anything (say i want to name a file made using Problem Steps Recorder)
  • Environment VARIABLES start with $env:
  • if there are more variables in a string they need to be surrounded in $() to be properly expanded
  • get-date with the –f custom format parameter returns string that does not contain characters forbidden in file names such as backslash (\), double colon (:) etc. Again it needs to be surrounded in $() to be properly expanded inside double quotes
  • to insert arbitrary characters into the custom date format string escape them with backslash ie. get-date -f “yyyy-MM-dd \a\t HH-mm-ss”

The outcome is a file in the user profile temp folder (%TEMP%)

file

PSR is useful and evil « annoyedadmin

PSR is useful and evil « annoyedadmin.

Instapaper

Instapaper delivered to your Kindle changes how you consume web content – Plus IFTTT, blogs and more.

FaceBook module for Powershell. | Aman Dhallys Blog

FaceBook module for Powershell. | Aman Dhallys Blog.

Windows 7 Themes Folder Location

Windows 7 Themes Folder Location.

Security Compliance Manager (SCM) v2.5 Out Now

Security Compliance Manager (SCM) v2.5 Out Now.

Best Practice: How to use Group Policy to turn off Backup Notification in the Windows 7 Action Center – The Easier Way

Best Practice: How to use Group Policy to turn off Backup Notification in the Windows 7 Action Center – The Easier Way.

smsagent

Scripts, tools and tips, mostly around Microsoft SCCM and EMS

To The Point

Anything about Technology and Business

Brian's Power Windows Blog

Microsoft in the Enterprise. Windows, Hyper-V, Exchange, SQL, and more!

PowerScripting Podcast

Shownotes and links for the PowerScripting Podcast, a podcast to help people learn Windows Powershell

Learn Powershell | Achieve More

What is this Powershell of which you speak?