38 lines
1.0 KiB
PowerShell
38 lines
1.0 KiB
PowerShell
$UserName = $env:USERNAME
|
|
|
|
$root = [ADSI]"LDAP://RootDSE"
|
|
$base = "LDAP://$($root.defaultNamingContext)"
|
|
|
|
$searchRoot = [ADSI]$base
|
|
|
|
$searcher = New-Object System.DirectoryServices.DirectorySearcher($searchRoot)
|
|
$searcher.Filter = "(&(objectCategory=person)(objectClass=user)(sAMAccountName=$UserName))"
|
|
|
|
$searcher.PageSize = 1
|
|
|
|
$result = $searcher.FindOne()
|
|
|
|
$props = $result.Properties
|
|
|
|
$DisplayName = $props["displayname"][0]
|
|
$Position = $props["title"][0]
|
|
$Telefon = $props["telephonenumber"][0]
|
|
$Mail = $props["mail"][0]
|
|
|
|
# Signaturpfad
|
|
$File = "\\vsql01\FLOWFACT\subcura\Outlook_Signatur\ohne_KontaktBild\WIP-Dresden GmbH.html"
|
|
|
|
$html = Get-Content $File -Raw
|
|
|
|
$html = $html.Replace("{BEN_NAME}", $DisplayName)
|
|
$html = $html.Replace("{BEN_POSITION}", $Position)
|
|
$html = $html.Replace("{BEN_TelefonBuero}", $Telefon)
|
|
$html = $html.Replace("{BEN_email}", $Mail)
|
|
|
|
$TempFile = "$env:TEMP\signature_preview.html"
|
|
|
|
# schreiben
|
|
Set-Content -Path $TempFile -Value $html -Encoding UTF8
|
|
|
|
# anzeigen
|
|
Start-Process $TempFile |