- name: Information about postgres
postgresql_info:
db: postgres
filter: databases
become: yes
become_user: postgres
register: pgdb
- debug: var=pgdb
"pgdb": {
"changed": false,
"databases": {
"postgres": {
"access_priv": "",
"collate": "en_US.UTF-8",
"ctype": "en_US.UTF-8",
"encoding": "UTF8",
"extensions": {
"plpgsql": {
"description": "PL/pgSQL procedural language",
"extversion": {
"major": 1,
"minor": 0
},
"nspname": "pg_catalog"
}
},
}
}
происходило это только тогда, когда кодировка не ru_RU.UTF-8 (чтобы базу с данными не удалить)?
Format-Hex -InputObject $macs[1,0]
#Require -Module PoshRSJob -Version 4.0
function Get-LastLogon {
<#
.Notes
Author: Max Kozlov
.Synopsis
Determine Last Logon Times on all domain controllers
.Description
Determine Last Logon Times on all domain controllers
Check All DC for LastLogon info
Get DC list from System.DirectoryServices.ActiveDirectory.Domain.GetCurrentDomain()
.Parameter UserName
UserNames to check
.Parameter DisplayAll
Display All info
.Example
# Get Last Logon time for Kozlov
Get-LastLogon Kozlov
.Example
# Get Last Logon time for Kozlov, Slepushkin
'Kozlov', 'Slepushkin' | Get-LastLogon -DisplayAll
#>
[CmdletBinding()]
param(
[string[]][Parameter(Mandatory=$true, ValueFromPipeline=$true, Position=0)]$UserName,
[Alias('All')]
[switch]$DisplayAll=$false
)
BEGIN {
$DCS = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().DomainControllers
$rootNC = ([adsi]'LDAP://RootDSE').rootDomainNamingContext.ToString()
$jobs = New-Object System.Collections.ArrayList
}
PROCESS {
$pj =
foreach ($user in $UserName) {
$DCS | Start-RSJob {
$dc = $_
$ds = New-Object System.DirectoryServices.DirectorySearcher
#$ds.SearchRoot = "LDAP://$($dc.Name)/$($dc.Partitions[0])"
$ds.SearchRoot = 'LDAP://{0}/{1}' -f $dc.Name, $using:rootNC
$ds.Filter = "(ANR={0})" -f $using:user
[void]$ds.PropertiesToLoad.Add('LastLogon')
[void]$ds.PropertiesToLoad.Add('samAccountName')
$ds.FindAll() | Foreach-Object {
[PSCustomObject]@{
DomainController = $dc.Name
UserName = $_.Properties.samaccountname | Foreach-Object { $_ }
LastLogon = $_.Properties.lastlogon | Foreach-Object { [DateTime]::FromFileTime($_) }
}
}
}
}
[void]$jobs.AddRange($pj)
}
END {
$data = $jobs | Wait-RSJob | Receive-RSJob
$jobs | Remove-RSJob
if ($DisplayAll) {
$data
}
else {
$data | Group-Object -Property UserName | Foreach-Object {
$_.Group | Foreach-Object -Begin { $max = $_.Group[0] } -Process { if ($_.LastLogon -gt $max.LastLogon) { $max = $_ } } -End { $max }
}
}
}
}
Сам как раз решал эту же проблему - в результате решил сразу генерить именно 1280х720 - тогда передаёт без искажений