Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $date = Get-Date -Format "ddMMyyyy"
- $files = Get-ChildItem "C:\Temp\spooler" | Where {! $_.PSIsContainer}
- ForEach ($file in $files)
- {
- If($file.Name -Match $date)
- {
- wscript.exe $file.FullName
- }
- }
- #Scheduled Task :
- #schtasks.exe /CREATE /TN SpoolerCheck-SendMail01 /RU system /SC daily /ST 10:00:00 /TR "Powershell.exe D:\Documents\Scripts\spoolit.ps1"
- #date-id.vbs
- #CreateAFile()
- #DiscardScript()
- #
- #Function CreateAFile
- # Dim fso, MyFile
- # Set fso = CreateObject("Scripting.FileSystemObject")
- # Set MyFile = fso.CreateTextFile("C:\Temp\spooler\dummy.txt", True)
- # MyFile.WriteLine("This is a test.")
- # MyFile.Close
- #End Function
- #
- #Function DiscardScript()
- # Set objFSO = CreateObject("Scripting.FileSystemObject")
- # strScript = Wscript.ScriptFullName
- # objFSO.DeleteFile(strScript)
- #End Function
Add Comment
Please, Sign In to add comment