# 🐈⬛ 🐈⬛ UnderTheWire Century

### Century 0-1

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2Fdu8n4sXDITDNOiBNeE8H%2Fimage.png?alt=media\&token=3fdcdd2a-c102-4913-9491-82c4d9e55d67)

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FbGYapFKbK2yj4ZIoM1Nl%2Fimage.png?alt=media\&token=0a63b572-72e6-4ba2-a7e6-6247ed5ca007)

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FrUa2CVVYQ6dugUajEJAg%2Fimage.png?alt=media\&token=a9db3a35-e2a9-4d9b-8ff7-890180dc225d)

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FesaPucNtQoPrjYJyVHVl%2Fimage.png?alt=media\&token=12690204-d36c-4655-8dab-481d1122cc49)

<mark style="color:green;">**century**</mark>

### Century 1-2

Challenge ask us to find build verison of PowerShell instance.&#x20;

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FvSTYUUkM2hbC2vDBXNrB%2Fimage.png?alt=media\&token=25244f7f-b0ac-4cd2-ac35-ba132660ae85)

According to this [microsoft module](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_powershell_editions?view=powershell-7.2), we can list the detail of our PS using `$PSVersionTable` command.

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FkQ88gsSnRqHhLq4vmt9v%2Fimage.png?alt=media\&token=5e7c6280-82e6-4ba0-8797-94fc8d04dd7c)

<mark style="color:green;">**10.0.14393.4583**</mark>

### Century 2-3

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FPhIN0LHTf1gOOSYgOtsP%2Fimage.png?alt=media\&token=5bc2e7a9-aee8-45d9-a2a6-ce201633362e)

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2Fu3R54ERH5oyRrwxv1uF5%2Fimage.png?alt=media\&token=d9ff3fc8-4820-4a86-9e7d-33daf0af065b)

`Invoke-WebRequest` has the same function as wget command according to <https://linuxhint.com/run-wget-powershell/>.

<mark style="color:green;">**invoke-webrequest443**</mark>

### Century 3-4

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FW8U4hRBHxxq7UamtMMSO%2Fimage.png?alt=media\&token=790662c0-3ff7-489d-8725-8508f440a7d5)

We can use `(Get-ChildItem | Measure-Object)`.Count to get the total number of files in a directory.&#x20;

* Get-ChildItem = Equivalent to dir , get the items and child items in a folder or registry key.
* Measure-Object = measure the property of the command. There are various measurement parameters are available. For example, Average, Count, sum, maximum, minimum.
* .Count = to specify output for count only.

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FiG3VGBYlzg4ATyxdpviZ%2Fimage.png?alt=media\&token=05286c26-1152-4d20-a462-4784b38ab3d2)

<mark style="color:green;">**123**</mark>

### Century 4-5

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FVqtAUjDS4gPqzhQzNnaJ%2Fimage.png?alt=media\&token=5e39b678-a5f0-4ab6-8c59-a6c4f3392093)

CD to the directory either by pressing tab or specify directory name using '\file'.

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2F1EMZJd9Yv0yVbNBpG3it%2Fimage.png?alt=media\&token=70611c8a-ed31-4eda-9b43-bb0c013ff5c6)

<mark style="color:green;">**5548**</mark>

### Century 5-6

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FhH1fb3lUk5o5FVltCHp6%2Fimage.png?alt=media\&token=9eef14f9-c0cb-493a-ae8c-85dabf9943c6)

According to [PS module](https://docs.microsoft.com/en-us/powershell/module/activedirectory/get-addomain?view=windowsserver2022-ps), we can use `Get-ADDomain -Current LoggedOnUser` to get the domain information for the domain of the currently logged on user.

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2F5CTtu2FALYx7tjSR7Qhr%2Fimage.png?alt=media\&token=d4d06196-2e37-4cf1-9047-67947e320df7)

<mark style="color:green;">**underthewire3347**</mark>

### Century 6-7

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FLhKTBAzQ2QgepfqGsbLN%2Fimage.png?alt=media\&token=d9129c41-4ac3-4e8c-b9ec-d900afba5696)

Use option -Directory to only get folders. `(Get-ChildItem -Directory | Measure-Object).Count`&#x20;

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FzP0DIz5s6E91Rcjumcn1%2Fimage.png?alt=media\&token=83884652-feff-4a93-8c20-2b6183a43a5e)

<mark style="color:green;">**197**</mark>

### Century 7-8

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FdNk7j9uqFR243fk9hb8R%2Fimage.png?alt=media\&token=2f4ea018-40bb-49b6-aca3-ca41904250b4)

Use gci with -Recurse to repeat the command in all subfolder in the directory and specify the file name with -Filter.

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FVjUY6Sxw4aDZgauBb6Np%2Fimage.png?alt=media\&token=d7d92ef3-d8e3-45da-9fcd-7d18ed608a1d)

<mark style="color:green;">**7points**</mark>

### Century 8-9

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FgIhrd5DRCfHv6F6OTpy7%2Fimage.png?alt=media\&token=dd7f335c-5728-4583-b65e-d40700989c6a)

We can use `Get-Unique` which is the equivalent of uniq to get the non repeated words in the file. Then we use `Measure-Object` to count the unique entries.

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FkuRXHssaJIk2vF9AImn9%2Fimage.png?alt=media\&token=58bcc23d-94df-4091-8b3c-7661517602dd)

<mark style="color:green;">**696**</mark>

### Century 9-10

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FTS5veg2QkQpsZLRaMR2w%2Fimage.png?alt=media\&token=2376f02b-1515-4fb1-bc62-54fe41132f48)

We use [GetContent](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-content?view=powershell-7.2) with [-Delimiter](https://www.mssqltips.com/sqlservertip/5427/parsing-strings-from-delimiters-in-powershell/) " " to split the words into an array and find the 161st word by using Select -Index 160.( Array starts from 0).

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2Fi20ogaHg2iTGefKp0Ipc%2Fimage.png?alt=media\&token=d14dd568-d4a6-4722-8155-9796c6736ec7)

<mark style="color:green;">pierid</mark>

### Century 10-11

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FuWhMIeFnFUPcZEwnoelb%2Fimage.png?alt=media\&token=0117be3f-c464-4c8b-a877-a47e06e4b94a)

According to the answer from StackOverFlow, we can use `Get-WmiObject` cmdlet to get more details and information of a windows 32 service. Then we can use findstr [wuauserv](https://www.windows-commandline.com/start-stop-windows-update-service/)(windows update service) which is the equivalent of grep to get the  details of windows update service.

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2Fw9AMRgmGyCWttXnpTWbq%2Fimage.png?alt=media\&token=13e3d198-388d-4814-b0bc-b6c13cfc19f8)

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2Frs9ieh613wuWbylRsxrz%2Fimage.png?alt=media\&token=f7e5d06c-e120-4dd7-9363-26412e57c204)

<mark style="color:green;">**windowsupdates110**</mark>

### Century 11-12

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2Fc5nG2y2bZLVUgXQDtRtF%2Fimage.png?alt=media\&token=807bfb2c-f3ff-4f41-962b-bffe9f9e8f4d)

We can use gci -recurse -hidden 2>$null to find any hidden file in a directory.

* hidden = find file with only hidden property.
* 2>$null = discard error.

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2F2w8QHdl0KSGPNGQiG3mK%2Fimage.png?alt=media\&token=655c73ba-e616-4faa-b305-9e886bfbb3dd)

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FsSNb2x5w4R1ZOoIpc90o%2Fimage.png?alt=media\&token=aed7231f-835f-4ba8-85ca-975bd3acf20e)

<mark style="color:green;">**secret\_sauce**</mark>

### Century 12-13

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FQPECqneVu8wf7DO74rFz%2Fimage.png?alt=media\&token=d52c6556-6fbb-4af1-b215-81ca8cc2394f)

We use [Get-ADDomainController](https://docs.microsoft.com/en-us/powershell/module/activedirectory/get-addomaincontroller?view=windowsserver2022-ps) to get Active Directory domain controllers name.&#x20;

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FP5mmYUljcaArMAY1dpuN%2Fimage.png?alt=media\&token=bcd6293f-6060-4cad-b790-2d34ad9bde60)

After finding the domain controller name, we can use `Get-ADComputer -Identity "UTW" -Properties * | Select Name, Description`  to get the description of our AD name.

* Get-ADComputer = get active directory computer details.
* -Identity "UTW" = specify our AD name.
* -Properties \* = list all possible properties.
* Select Name, Description = filter out the only parameter we want.

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FmcIsBEvXQxKofwP4TBeR%2Fimage.png?alt=media\&token=81b4c054-1fc4-4b67-afa3-9dd899cd8a6c)

<mark style="color:green;">**i\_authenticate\_things**</mark>

### Century 13-14

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FgAyGL1Z5JtSooSGGaXl6%2Fimage.png?alt=media\&token=54b6907a-6d42-41ca-a69f-6896110cdbd6)

Use getcontent with Measure-Object -Word to only get words amount.

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2F4b1Xr2lX89p3VGW5G3FQ%2Fimage.png?alt=media\&token=b2e36803-1aca-463a-9f0b-c640e548121b)

<mark style="color:green;">**755**</mark>

### Century 14-15

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FH4bEgNJbGlu5NYrmVjhI%2Fimage.png?alt=media\&token=1906e8e9-680f-4113-b917-49e39b5a1d49)

Use getcontent with -Delimiter to split words into array. Then use findstr ^polo (^to specify whole word only) to grep polo. Lastly use count to count the number of polo words in the file.

![](https://621481992-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHlLUfRXFTexuwDKyKKx8%2Fuploads%2FJA3661KgGHv76An4g2Pp%2Fimage.png?alt=media\&token=b606c560-b226-4933-a56e-10dc124a54b2)

<mark style="color:green;">**153**</mark>
