Willkommen auf deiner Website! Das ist die Startseite, die die meisten deiner Besucher sehen werden, wenn sie deine Website zum ersten Mal aufrufen.
|
1 2 3 4 |
$UserCredential = Get-Credential pause $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell/ -Credential $UserCredential -Authentication Basic -AllowRedirection Import-PSSession $Session |
|
1 2 3 4 5 6 7 8 |
# Kennwort per eingabe # Convertierung nach secure string # eport in txt Datei Read-Host -AsSecureString | ConvertFrom-SecureString | Out-File e:\temp\pass.txt # Pass.txt Convertieren nach Securestring und als Variable verwenden in Powershell Script $securePass = cat E:\temp\pass.txt | ConvertTo-SecureString |
|
1 2 3 4 5 6 7 8 |
# Kennwort per eingabe # Convertierung nach secure string # eport in txt Datei Read-Host -AsSecureString | ConvertFrom-SecureString | Out-File e:\temp\pass.txt # Pass.txt Convertieren nach Securestring und als Variable verwenden in Powershell Script $securePass = cat E:\temp\pass.txt | ConvertTo-SecureString |
|
1 2 3 4 |
$UserCredential = Get-Credential pause $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell/ -Credential $UserCredential -Authentication Basic -AllowRedirection Import-PSSession $Session |
|
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 |
# Script created at 27.02.2017 by Arie Kuipers # Find aktivated Ad User in certain OU # Sort on Date that Password hasdt been changed. Oldest First. # Sselect Name, Description of Account, Paasword last set and Password (never) expires, to give as a header for export to CSV file # some variables and files $jetzt = get-date -uformat "%Y-%m-%d %H:%M:%S" $OutFile = "C:\Scripts\Technical-user.csv" $OU = "OU=Technical,OU=User,DC=dom,DC=com" Get-ADUser -filter * -properties description, passwordlastset, passwordneverexpires, enabled -Searchbase $OU | Sort-Object -Property passwordlastset |Select Name, description, passwordlastset, Passwordneverexpires | Export-Csv $OutFile -Encoding UTF8 # Script will send an email at the end. Needed Parameters $myServer = "$env:computername.$env:userdnsdomain" # Name der Maschine $emailFrom = "$myServer <user@domain.com>" # Servername und Distributionlist $emailBetreff = (get-date -uformat %Y-%m-%d)+" Overview of Technical User Password last set." $emailTo = "user@domain.com" # Production #$emailTo = "yourmailaccount@domain.com" # testing $emailCc = @("othermail@domain.com") # add futher smtp-addresses here $emailServer = "your.mail.server" # INFO: server that runs script must be allowed in FW, on mailrelay and in McAfee Virus Console outgoing connection to port 25 must be allowed! # create email $LogTXT = "Send email from '$emailFrom' with subject '$emailBetreff' to '$emailTo', cc to '$emailCc' and attachment '$OutFile' via smtp-server '$emailServer' ..." Write-Host $LogTXT Out-File $OutFile -Encoding UTF8 -InputObject $LogTXT -Append $emailBody = $PSCommandPath + " erzeugte bis $jetzt den Anhang`r`n$OutFile`r`n`r`n" Send-MailMessage -From $emailFrom -To $emailTo -Cc $emailCc -Subject $emailBetreff -SmtpServer $emailServer -Attachments $OutFile -Encoding UTF8 -Body $emailBody |