I hereby claim:
- I am Xplantefeve on github.
- I am xplantefeve (https://keybase.io/xplantefeve) on keybase.
- I have a public key whose fingerprint is BBA5 AAF0 DC6E 481C 091E A57D 8230 1914 C28F 3C6E
To claim this, I am signing this object:
| $ComputerName = $env:ComputerName | |
| $test = Import-Csv -Path "log:\computers\${ComputerName}.log" -Delimiter ' ' -header @('user','date','time') | |
| $t2 = $test | | |
| select user,date,@{ | |
| name='logonage'; | |
| expression={ | |
| 1 / ((Get-Date) - [DateTime]$_.date).Days} |
| <# | |
| .Synopsis | |
| Gets computer information from Surveyor | |
| .DESCRIPTION | |
| Returns computers from the Surveyor database. Can return information for | |
| specific computers or a filtered subset of the DB table. | |
| .EXAMPLE | |
| Get-SurveyorComputer -Name MyComputerName | |
| Returns information for the computer named MyComputerName. | |
| .EXAMPLE |
| <# | |
| .Synopsis | |
| Opens a connection to a SQL server. | |
| .DESCRIPTION | |
| Opens a connection to a SQL server and provides a sqlConnection object. | |
| the connection object has to be closed at the end of the processing. | |
| .EXAMPLE | |
| $con = Open-SQLServer -Server SQLSVR -Database MyDataBase | |
| Opens a connection to the MyDataBase DB on SQLSVR. | |
| .LINK |
| <# | |
| .Synopsis | |
| Gets computer info from SCCM | |
| .DESCRIPTION | |
| Retrieves computers from SCCM, with optional targeting and filtering | |
| .INPUTS | |
| [System.String] | |
| .OUTPUTS | |
| [System.Management.ManagementObject#root\sms\site_SCM\SMS_R_System] | |
| .EXAMPLE |
| $domainControllers = Get-ADDomainController -Filter * | |
| Get-ADGroupMember -Identity 'Domain Admins' -Recursive | ForEach-Object -Process { | |
| $user = $_ | |
| $domainControllers | | |
| ForEach-Object -Process { | |
| Get-ADUser $user.SamAccountName -Server $_.Name -Properties lastLogon, cn, employeeNumber, accountExpires, PasswordNeverExpires, Enabled, LockedOut, pwdLastSet | |
| } | | |
| Sort-Object -Property LastLogon | | |
| Select-Object -Last 1 -Property SamAccountName, |
| <# | |
| .Synopsis | |
| Gets uptime information | |
| .EXAMPLE | |
| Get-Uptime -ComputerName URANUS | |
| .INPUTS | |
| String[] | |
| .OUTPUTS | |
| CUSTOM.UptimeInfo | |
| .NOTES |
| <# | |
| .Synopsis | |
| Short description | |
| .DESCRIPTION | |
| Long description | |
| .EXAMPLE | |
| Example of how to use this cmdlet | |
| .EXAMPLE | |
| Another example of how to use this cmdlet | |
| #> |
I hereby claim:
To claim this, I am signing this object:
| # Answer to http://powershell.org/wp/2016/03/05/2016-march-scripting-games-puzzle/ | |
| Function Get-HumanReadableSize($size) { | |
| If ( $size -lt 1KB) { Return $size } | |
| ElseIf ( $size -lt 1MB) { Return "$([math]::Round(($size / 1KB),2))Kb" } | |
| ElseIf ( $size -lt 1GB) { Return "$([math]::Round(($size / 1MB),2))Mb" } | |
| ElseIf ( $size -lt 1TB) { Return "$([math]::Round(($size / 1MB),2))Gb" } | |
| Else { Return "$([math]::Round(($size / 1TB),2)) TB" } | |
| } |
| <# | |
| .Synopsis | |
| Creates a timer with display | |
| .DESCRIPTION | |
| Creates a timer that writes the progress of the current action and the estimated remaining time. | |
| Suppose you have $Items, an array of items to process. | |
| First, you create a timer initialized to the number of items in the array: | |
| $MyTimer = New-Timer -TotalItems $Items.count -Activity 'Processing items' |