Quantcast
Channel: THWACK: All Content - Orion SDK
Viewing all articles
Browse latest Browse all 2677

How to pass in parameter to PS script

$
0
0

I have a PS script that will delete msi files that are older than 1 year. I set up an alert to trigger if there's less than 2gb of space left on the C:\ drive. I want this script to execute against the triggered node. How do i pass in the node that was triggered to the script?

 

Here's my code:

$DeleteOlderThan = (Get-Date).AddDays(-365) #files older than a year

$Destination = "C:\Windows\Installer\" #path

 

Get-ChildItem $Destination -File | Where-Object { $_.LastWriteTime -lt $DeleteOlderThan } | Remove-Item -Include "*.msi" -Force #delete msi files


Viewing all articles
Browse latest Browse all 2677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>