1
[Max] General Discussion / Re: Corona Renderer DrServer status job to Zabbix
« on: 2020-03-11, 10:01:38 »
slightly modified script
he became more informative
produces:
HOSTNAME
IPADDRESS
Username
--------------------------------
domain\username
#set path variable
$LogPath = "\\server\C$\Users\administrator\AppData\Local\CoronaRenderer\DrData\Drlog.txt"
#Got string with iP
$Lines = Get-Content $LogPath | Where-Object {$_ -match "Accepted remote connection from"}
#pull out last ip from $lines var
$IP = ($Lines | Select-String -Pattern "\d{1,3}(\.\d{1,3}){3}" -AllMatches).Matches.Value | Select-Object -Last 1
#resolve ip to DNS
(Resolve-DnsName $IP -ErrorAction SilentlyContinue).NAMEHOST
$IP
Get-WmiObject -ComputerName $IP -Class Win32_ComputerSystem | Select-Object UserName
he became more informative
produces:
HOSTNAME
IPADDRESS
Username
--------------------------------
domain\username
#set path variable
$LogPath = "\\server\C$\Users\administrator\AppData\Local\CoronaRenderer\DrData\Drlog.txt"
#Got string with iP
$Lines = Get-Content $LogPath | Where-Object {$_ -match "Accepted remote connection from"}
#pull out last ip from $lines var
$IP = ($Lines | Select-String -Pattern "\d{1,3}(\.\d{1,3}){3}" -AllMatches).Matches.Value | Select-Object -Last 1
#resolve ip to DNS
(Resolve-DnsName $IP -ErrorAction SilentlyContinue).NAMEHOST
$IP
Get-WmiObject -ComputerName $IP -Class Win32_ComputerSystem | Select-Object UserName