Using the date function in PowerShell is easy. To get started, use the following to display today's date:
$date = (Get-Date).ToString('MM/dd/yyyy')
write-host $date
You probably want to include the date in another string, like this:
$date = (Get-Date).ToString('MM/dd/yyyy')
$today = "Today's date is $date."
write-host $today
The previous examples work's great because there is a space after the word "is" and before the $date function. However, if there are no spaces, we need to put the date function in parenthesis.
$date = (Get-Date).ToString('MM/dd/yyyy')
$file= "Here is the file you requested: example$($date).pdf"
write-host $file