expirate date to exe

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 1 year and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
tupac4u2023
Posts: 2
Last visit: Fri Dec 22, 2023 6:35 pm

expirate date to exe

Post by tupac4u2023 »

Hi there, how to add expirate date to *.exe with creation date +30 days
Last edited by tupac4u2023 on Sat Jan 14, 2023 3:31 pm, edited 2 times in total.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: expire date to exe

Post by jvierra »

I am not sure what you are trying to ask but there is no "Expire Date" on Windows files.
tupac4u2023
Posts: 2
Last visit: Fri Dec 22, 2023 6:35 pm

Re: expire date to exe

Post by tupac4u2023 »

jvierra wrote: Sat Jan 14, 2023 1:56 pm I am not sure what you are trying to ask but there is no "Expire Date" on Windows files.
Thanks for reply, something like this, but using the creation date of the *.exe or script and after 30 days it cannot be executed.

$DTCurrent = get-date
$DTExpiry = [datetime]::ParseExact('30/11/2019','dd/MM/yyyy',$null)

if ($DTCurrent -gt $DTExpiry)
{
Write-Host "Thats all folks, $($Filename.Name) is expired"
break
}
else
{
Write-Host "Keep Running: $($Filename.Name)"
}
This topic is 1 year and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked