Folks,
I need some help, I wrote the below to scan for certain files types on client machines but I cant get the script to scan anything other than the C$. Apologies I am kind of new to scripting and PS. The script is kicked off using a batch file that makes the CR directory on the clients. I think the problem stems from the $disk variable or the way I have used foreach or the loop - any help would be appreciated
Set-Location c:\ $s = new-object -comObject SAPI.SPVoice $s.speak("Scan in progress") write-host "Scanning for files" $Extension = @("*.zip","*.rar","*.ppt","*.pdf") $Path = "$env:userprofile\Desktop" $disks = "c$","D$" foreach ($disks in $disks) {get-childitem -force -include $Extension -recurs -EA SilentlyContinue >$path\files.txt} $s.speak("Scan completed") Write-Host "Scan complete, files.txt created on your desktop - press any key to exit..." $x = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp") Remove-Item c:\cr -recurse -EA SilentlyContinue exit