Hello, how can i extract only the exact SID key from the registry with a .bat like this:
ExtractSID.bat:
REG QUERY HKU |Findstr /R "DEFAULT S-1-5-[0-9]*-[0-9-]*$" >> SID.txt
With result on file SID.txt:
HKEY_USERS.DEFAULT
HKEY_USERSS-1-5-21-57989841-484763869-1957994488-1003
What i need on SID.txt:
S-1-5-21-57989841-484763869-1957994488-1003
Add a line that filters using the FIND command to exclude lines with a specific string in them.
type SID.txt | find /v /i "default" >ONLY_SID.txt
The /v tells FIND to ignore the string "default" and the /i makes it case insensitive.
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!
Discuss This Question: 2  Replies