Advertisement
Guest User

Is that older than this date?

a guest
Jan 23rd, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $DebugPreference = "Continue"    #Continue|SilentlyContinue
  2.  
  3. $64BitOS = "C:\Program Files (x86)\DELL\KACE\Inventory.log"
  4. $32BitOS = "C:\Program Files\DELL\KACE\Inventory.log"
  5.  
  6. $CompareDate = (Get-Date).AddDays(-20)
  7.  
  8. If (Test-Path $64BitOS)
  9.         {Write-Debug 'File Found.'
  10.          $FileObject64BitOS = Get-ItemProperty $64BitOS
  11.          If ($FileObject64BitOS.LastWriteTime -gt $CompareDate)
  12.                  {Write-Debug 'KACE up to date.'}
  13.              Else{Write-Debug 'KACE not up to date, file is older than compare date.'
  14.                   Out-File \\vlsrv02\nokace\"$env:computername No or OLD KACE Version.txt"}}
  15.  
  16. If (Test-Path $32BitOS)
  17.         {Write-Debug 'File Found.'
  18.          $FileObject32BitOS = Get-ItemProperty $32BitOS
  19.          If ($FileObject32BitOS.LastWriteTime -lt $CompareDate)
  20.                  {Write-Debug 'KACE up to date.'}
  21.              Else{Write-Debug 'KACE not up to date, file is older than compare date.'
  22.                   Out-File \\vlsrv02\nokace\"$env:computername No or OLD KACE Version.txt"}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement