title: List Inactive Directories
body: <p>I'm a big dumb dummy trying to create a PowerShell script which will list all directories that contain files and subdirectories that have not been modified in 90 days. I'm not an experienced scripter, so I searched around and found the script below.</p>
  
  <pre class="lang-vb prettyprint-override"><code>Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objStartFolder = objFSO.GetFolder("C:\Scripts")
  Set colFiles = objStartFolder.Files
  
  i = 0
  
  For Each objFile in colFiles
      dtmDate = objFile.DateLastModified
      intAge = DateDiff("d", dtmDate, Date)
  
      If intAge &lt; 90 Then
          i = 1
          Exit For
      End If
  Next
  
  If i = 0 Then
      Wscript.Echo objStartFolder.Path
  End If
  
  ShowSubfolders(objStartFolder) 
  
  Sub ShowSubFolders(Folder)
      For Each objSubfolder in Folder.SubFolders
          Set objFolder = objFSO.GetFolder(objSubFolder.Path)
          Set colFiles = objFolder.Files
  
          i = 0
  
          For Each objFile in colFiles
              dtmDate = objFile.DateLastModified
              intAge = DateDiff("d", dtmDate, Date)
  
              If intAge &lt; 90 Then
                  i = 1
                  Exit For
              End If
          Next
  
          If i = 0 Then
              Wscript.Echo objSubfolder.Path
          End If
  
          ShowSubFolders objSubfolder
      Next
  End Sub
  </code></pre>
  
  <p>Awesome, so I've run this on my Windows system, but it returns the following error:</p>
  
  <pre class="lang-none prettyprint-override"><code>Missing opening '(' after keyword 'for'.
  At F:\find.ps1:8 char:5
  + For  &lt;&lt;&lt;&lt; Each objFile in colFiles
      + CategoryInfo          : ParserError: (OpenParenToken:Token
      + FullyQualifiedErrorId : MissingOpenParenthesisAfterKeyword
  </code></pre>
  
  <p>I've played with it, guessing at how/where to add "(" but I don't really get anywhere.</p>