CenturyΒΆ
- Doing the Slack: century1:century1
- $psversiontable : century2:10.0.14393.7604
- $PSVersion doesn’t work in version 1, also GetHost is not reliable (only host PS)
- Get-Host is useful but not here
- Invoke-WebRequest and dir gives u everything
- use lowercase
- century3:invoke-webrequest443
- dir is alias for Get-ChildItem
- a simple (dir).count gets vtotal
- century4:123
- century5:6265
- to go into folders with spaces, encapsulate path in single quotes
- century6: underthewire3347
- (Get-CimInstance Win32_NTDomain | ?{$_.Status -eq “OK”}).DomainName
[System.DirectoryServices.ActiveDirectory.Domain]::GetComputerDomain()
- $env:USERDNSDOMAIN
- also :COMPUTERNAME and :USERNAME
- century7:197
- same as for #4
- use -Directory flag
- for files, gci -File
- century8:7points
- gci - Recurse
- century9:696
- Get-Content .\unique.txt | Sort-Object -unique | Measure-Object -line
- or type and sort as cmd’s
- century10:pierid
- $file = gc Word_file.txt
- $file.split(’ )
- Select-Object -Index 160 or you could do [160] for 161st if u have a variable
- century11:windowsupdates110
- Get-Service -> lists all services
- findstr / Select-String -> findstr works better
- findstr “Update”
- service name is wuauserv
- Get-WmiObject win32_service is more verbsose than Get-Service
- pipe into | Select Name, Description
- Select SPecific:
- Get-WmiObject win32_service | ?{$_.NAME -like “wuauserv”} | Select Description | $_.Description
- ($desc).Description.split(" “) | Select-Object -Index 9,8
- century12:secret_sauce
- -Force with dir
- Get-ChildItem | Get-ChildItem -Recurse -File -Hidden | Where-Object {$_.Name -ne ‘desktop.ini’}
- century13:i_authenticate_things
- Manner of waves:
- Get-ADComputer gets information about computer
- needs -Properties Description to get desc
- also initial run needs -Filter “*” to get all
- Alternatively:
- Get-ADDomainController to get name first
- cenutry14:755
- How i did it: $file = gc file -> gc.split(” “) | Measure-Object -line
- Measure-Object -Word exists
- century15:158
- (Select-String -Path .\countpolos -Pattern “polo” -AllMatches).Matches.count)