Difference between revisions of "Power Shell"

Jump to navigation Jump to search
603 bytes added ,  11:38, 2 November 2010
→‎Datetime: Added "Improper Formatting"
(→‎SMTP / Email Sending: Added HTML and Authentication)
(→‎Datetime: Added "Improper Formatting")
Line 217: Line 217:
The object structure: http://msdn.microsoft.com/en-us/library/system.datetime.aspx
The object structure: http://msdn.microsoft.com/en-us/library/system.datetime.aspx


<br>'''Converters'''<br>
'''Improper Formatting'''<br>
Be aware that if you live somewhere dates are normally formatted properly (eg not the USA), then Powershell (or the underlying DateTime object type) has a nasty habit of returning a string formatted with day and month swapped around.  If you do a <code> Get-Date </code> it all looks fine, but then you output a DateTime object in a script to some text and its wrong.  Add the <code> .ToString() </code> method to the end at it'll sort itself, though quite why when you're concatenating the object into a string the object needs to be explicitly told seems a bit superfluous.
 
'''Converters'''<br>
<source lang="powershell">
<source lang="powershell">
function ConvertLocalToUnix([datetime]$datetime)
function ConvertLocalToUnix([datetime]$datetime)

Navigation menu