For a check i need yesterday\'s date at 10:00pm in a variable.
I get yesterdays Date and current Time with
$a = (get-date).AddDays(-1)
I see this topic, but in my case I was looking for a way to improve the format. Using UFormat and adding -1 day
(get-date (get-date).addDays(-1) -UFormat "%Y%m%d-%H%M")