Hi All, I'm a beginner (Im sure you hear that all the time!)
I'm looking to do this step by step so i understand how it all works, thanks in advance for the help.
Outcome: Powershell to look at a list of computers in a text file, search only their C:drive's, for file extensions *.pst and *.doc and output a list to a csv file with columns computername, filename, path, size, and also specifying if the computer cannot be found or if no such file exists on the computer.
To start and to get the basics correct , should I use
get-wmiobject -query "Select * from CIM_DataFile Where Extension = 'pst'" -ComputerName (Get-Content C:\scripts\computernames.txt)
The problem here - is it searches all of the mapped drives - I just want the c:drive's and I'm not sure where to go after this
I cant use get-childitem as the group policy in our company doesn't permit even admin to get this detail.
I am really just looking for a concrete start as I keep coming up against a brick wall ...
Add the drive as part of the WHERE clause
Get-WmiObject -Query "SELECT * from CIM_DataFile WHERE Drive = 'C:' AND Extension = 'doc'"
Get-WmiObject -Query "SELECT * from CIM_DataFile WHERE Drive = 'C:' AND Extension = 'pst'"