Powershell GUI fronted (WPF) to run categorized console scripts

โŒˆโŒ‹ โŽ‡ branch:  ClickyColoury


Check-in [8d7d5133e8]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Mini tool to look up some basic infos on servers/hostnames
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8d7d5133e8ec948c440c27721aefcefe1e82bfd3
User & Date: mario 2017-09-24 15:32:29
Context
2018-04-08
09:47
Migration to PS5 file renaming. Remove function copying in New-GuiThread; check-in: e114cf1bc5 user: mario tags: trunk
09:39
Create new branch named "ps5" check-in: 96227c9c17 user: mario tags: ps5
2017-09-24
15:32
Mini tool to look up some basic infos on servers/hostnames check-in: 8d7d5133e8 user: mario tags: trunk
15:28
remmoved double icon check-in: feb6e01361 user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added tools/beta/serverowner.ps1.













































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# api: multitool
# version: 0.9
# title: Server owner
# description: Find OU and app owner
# type: inline
# category: beta
# x_category: network
# icon: info
# key: n7|serverinfo
# config: -
#
# โ supply servername in computername field
#
# โ users Get-ADComputer $server for basic details
#
# โ data/servers.*.csv
#    - e.g. servers.office1.csv + servers.our_webhoster.csv + servers.under_cupboard.csv
#    - meant as custom extra info lists
#    - export as CSV with e.g. one "Hostname" field
#
# โ You might have to adapt the OU= extraction (or remove, if the AD
#   structure yields nothing interesting otherwise)


Param(
    $server = (Read-Host "Machine"),
    $automat = 0
)


#-- AD/OU
$server = $server.toUpper()
try {
    $ad = Get-ADComputer $server -Prop *
    $dn = $ad.DistinguishedName
    if ($dn -match "OU=(?!Server|Computer)(\w+)") {
        $dn = $matches[1]
    }
}
catch {
    Write-Host -f Yellow -b Red " โœ˜ No AD entry for $server"
    $ad = @{ DNSHostName=$server; OperatingSystem="OS=n/a"; SamAccountName="SAM=n/a" }
    $dn = "OU=n/a (shadowed/routed-only?)"
}
$site = "unknown site"
try {
    if ($x = (& nltest /server:$machine /dsgetsite)) {
        $site = $x[0]
    }
}
catch {}
try {
    $ip = [System.Net.Dns]::GetHostAddresses($machine)
}
catch {
    $ip = "not revolved"
}
Write-Host -f White  " โ $($ad.DNSHostName)"
Write-Host -f Yellow -b Red " โžœ $dn"
Write-Host -f Yellow " โคท $site"
Write-Host -f Yellow " โ IP=$ip"
Write-Host -f Yellow " โ $($ad.OperatingSystem)"
Write-Host -f Yellow " โ $($ad.SamAccountName)"


#-- Ping
if (Test-connection -quiet $server) {
    Write-Host -b Green " โœ” online"
}
else {
    Write-Host -b Red " โœ˜ not online"
}


#-- CSV infos (app owner)
ForEach ($fn in (dir "./data/servers.*.csv")) {
    if ($csv = Import-Csv $fn) {
        $r = ($csv | ? { $_.Hostname -eq $server -or $_."Virtual Machine" -eq $server })
    }
    if ($r) {
        Write-Host ""
        Write-Host -f Cyan " โ $($fn.Name)"
        ($r | FL | Out-String).trim() | Write-Host
    }
}