Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ALLE ONLINE PC HERAUSFINDEN
- #get-ADComputer -Filter "OperatingSystem -like 'Win*'" -credential $adcred -Properties * #| Format-Table Name, OperatingSystem, LastLogonDate -Autosize
- #FENSTERGRÖßE ANPASSEN
- $pshost = get-host
- $pswindow = $pshost.ui.rawui
- $newsize = $pswindow.buffersize
- $newsize.height = 3000
- $newsize.width = 94
- $pswindow.buffersize = $newsize
- $newsize = $pswindow.windowsize
- $newsize.height = 60
- $newsize.width = 94
- $pswindow.windowsize = $newsize
- #AD ZUGANGSDATEN DEFINIEREN
- $ADuser = 'DOMAIN\Administrator'
- $ADpass = 'Password'
- $encpass = $ADpass | ConvertTo-SecureString -AsPlainText -Force
- $adcred = New-Object pscredential($ADuser, $encpass)
- Import-Module active*
- $rtn = $null
- write-host -ForegroundColor white "Aktueller PC Status:"
- Get-ADComputer -Filter "OperatingSystem -like 'Win*'" -credential $adcred -Properties * |
- ForEach-Object {
- $rtn = Test-Connection -CN $_.dnshostname -Count 1 -BufferSize 16 -Quiet
- IF($rtn -match ‘True’) {
- write-host -ForegroundColor green $_.dnshostname
- }
- ELSE {
- Write-host -ForegroundColor red $_.dnshostname
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement