I'm working on another application within Powershell Studio to delete certain folders\files. I have this command that is working on REMOTE machines that I would like to alter for
I can provide the computer name and user name in text boxes so in my invoke-command line, you'll see $AssetName.Text and that's why. I'm providing it in a text box
Before we get too far, here are my issues
Exclude profiles that have been used in 90 days but DON'T delete files that are older than 90 days ie.. a word doc I haven't used in 91 days but may need it 6 months from now
In other folders (yes I know they will be two seperate commands ) delete folders before 1/1/2015
This is the command that I'd like to use or something very similar:
Invoke-Command -ComputerName $AssetName.Text -ScriptBlock { Remove-Item C:\Users\* -Exclude "administrator", "public", "default", "all users", "default user",}
I'm aware of this (Get-Date).AddDays(-90) but I'm not sure where to put it and if it will do as I need
Any help, suggestions or comments are appreciated