Skip to content

Instantly share code, notes, and snippets.

@AdilHindistan
Created March 21, 2014 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdilHindistan/9698886 to your computer and use it in GitHub Desktop.
Save AdilHindistan/9698886 to your computer and use it in GitHub Desktop.
## Query cim_datafile class to find an executable
# http://msdn.microsoft.com/en-us/library/aa387236(v=vs.85).aspx
get-wmiObject -query "select FileName,Extension,FileSize,Path,CreationDate,InstallDate,LastAccessed from cim_datafile where Drive='d:' AND FileName='powershell' and extension='exe'"
CreationDate : 20130822065947.699027-240
Extension : exe
FileName : powershell
FileSize : 479744
InstallDate : 20130822065947.699027-240
LastAccessed : 20130822065947.699027-240
Path : \windows\system32\windowspowershell\v1.0\
PSComputerName :
CreationDate : 20130821233619.548432-240
Extension : exe
FileName : powershell
FileSize : 461312
InstallDate : 20130821233619.548432-240
LastAccessed : 20130821233619.548432-240
Path : \windows\syswow64\windowspowershell\v1.0\
PSComputerName :
## if no properties are specified
H:\> gwmi cim_datafile -filter "Drive='d:' AND FileName='powershell' and extension='exe'"
Compressed : False
Encrypted : False
Size :
Hidden : False
Name : d:\windows\system32\windowspowershell\v1.0\powershell.exe
Readable : True
System : False
Version : 6.3.9600.16384
Writeable : True
Compressed : False
Encrypted : False
Size :
Hidden : False
Name : d:\windows\syswow64\windowspowershell\v1.0\powershell.exe
Readable : True
System : False
Version : 6.3.9600.16384
Writeable : True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment