search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
How to create timestamp on Powershell?
Posted in Windows Powershell | No Comment | 5,123 views | 07/06/2009 10:21

This is a basic script to create timestamp using Get-Date command.

1
2
3
4
5
6
7
8
9
10
11
Function TimeStamp 
    {
        $now=Get-Date
        $yr=$now.Year.ToString()
        $mo=$now.Month.ToString()
        $dy=$now.Day.ToString()
        $hr=$now.Hour.ToString()
        $mi=$now.Minute.ToString()
        write-output $yr$mo$dy$hr$mi
    }
$timestamp = TimeStamp

You can use timestamp with any script to create random files.



Leave a Reply