Im trying to find every drive letter that isnt “C,E,L,S,T,W” on a windows 2008 server. Can anyone tell me the fault in my logic or how i can do this please?
[char[]]”CELSTW” | Where-Object {!(Get-PSDrive $_ )}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You are starting out with a list of drive letters you don’t want (CELSTW) and outputting the ones that don’t exist as a psdrive.
What you want is to start with a list of all PSDrives and filter them out where they match the ones you don’t want:
Although that is going to give you a bunch of other PSDrive types. You probably also want to filter it for the FileSystem provider: