I am looking to create a long script that does many things.
First the script will get a list of folders in a directory and output to a file I have this code below
Get-ChildItem -Path "filepath" | Select-Object Name | Out-File c:\dir.txt
The output of the file would look like
- Name
- -
- 1234556 Description 1
- 1244556 Description 2
- 1234456 Description 3
I want to delete the first two lines then strip all the characters in the list except for the first 7 numbers and add the same text to the end of each directory name like this:
- 1234556Descript
- 1244556Descript
- 1234456Descript
Then after that is done I want to create an AD group from this list of names.