[dba-Tech] PowerShell - formatting output

Gustav Brock gustav at cactus.dk
Mon Mar 10 16:13:07 CDT 2014


Hi John

I guess something like this:

    Write-Host "Expiration Date"$xml.RegistrationConfig.ExpireDate.ToShortDateString()

/gustav

________________________________________
Fra: dba-tech-bounces at databaseadvisors.com <dba-tech-bounces at databaseadvisors.com> på vegne af John Bartow <jbartow at winhaven.net>
Sendt: 10. marts 2014 20:42
Til: DBA-Tech
Emne: [dba-Tech] PowerShell - formatting output

Is anyone on this list familiar with PowerShell formatting?

I want to grab a datetime value out of an xml file and output it in a
friendly display rather than what I'm getting now: 2015-01-20T00:00:00

Try {
        $xml = [xml](get-content C:\ProgramData\ACME\RegistrationConfig.xml)
#C:\Programdata\RegistrationConfig.xml
        Write-Host "Expiration Date"$xml.RegistrationConfig.ExpireDate
        exit 0
        }
Catch {
        Write-Host "Failure"
        exit 1001
          }

TIA
John B



More information about the dba-Tech mailing list