add filename extension

  • I found this script online and would like to add a datestamp to the file.
    Schedule this to run everyday. How do I do this?
    Thanks

    .

  • Time to learn Powershell !

    To keep it simple, just add an extra variable (e.g. $ResultFileName )


    #Create the report and save it to a file
    $ResultFileName = $('{0}\FolderSizes_{1}.html' -f $ReportPath, (get-date -Format 'yyyyMMdd'));
    $HTML = $Report | Select 'Folder Name',Owner,'Created On','Last Updated',Size | Sort $SortBy -Descending:$Descending | ConvertTo-Html -PreContent $Pre -PostContent $Post -Head $Header | Set-AlternatingRows -CSSEvenClass even -CSSOddClass odd | Out-File $ResultFileName ;

    #Display the report in your default browser
    & "$ResultFileName"

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply