REGEX remove blank lines:
FROM: http://www.ultraedit.com/support/tutorials_power_tips/ultraedit/remove_blank_lines.html
FIND:
^(?:[\t ]*(?:\r?\n|\r))+
| ([adsi]'WinNT://domain/username,user').ChangePassword('oldpassword','newpassword') |
| ######################################################################### | |
| # # | |
| # Script to set or clear read-only flag of an NTFS volume. # | |
| # # | |
| # Usage: .\set-ntfs-ro.ps1 set "MY DISK LABEL" # | |
| # .\set-ntfs-ro.ps1 clear "MY DISK LABEL" # | |
| # # | |
| # Author: Muhammed Demirbas, mmdemirbas at gmail dot com # | |
| # Date : 2013-03-23 # | |
| # # |
| #requires -Version 3.0 | |
| <# | |
| .SYNOPSIS | |
| My Veeam Report is a flexible reporting script for Veeam Backup and | |
| Replication. | |
| .DESCRIPTION | |
| My Veeam Report is a flexible reporting script for Veeam Backup and | |
| Replication. This report can be customized to report on Backup, Replication, |
| #requires -version 2 | |
| <# | |
| .SYNOPSIS | |
| <Overview of script> | |
| .DESCRIPTION | |
| <Brief description of script> | |
| .PARAMETER <Parameter_Name> | |
| <Brief description of parameter input required. Repeat this attribute if required> |
REGEX remove blank lines:
FROM: http://www.ultraedit.com/support/tutorials_power_tips/ultraedit/remove_blank_lines.html
FIND:
^(?:[\t ]*(?:\r?\n|\r))+
| function Get-DiskFree | |
| { | |
| [CmdletBinding()] | |
| param | |
| ( | |
| [Parameter(Position=0, | |
| ValueFromPipeline=$true, | |
| ValueFromPipelineByPropertyName=$true)] | |
| [Alias('hostname')] | |
| [Alias('cn')] |
| # | |
| # Originally from: "http://sbrickey.com/Tech/Blog/Post/Parsing_IIS_Logs_with_PowerShell" | |
| # | |
| # Define the location of log files and a temporary file | |
| $LogFolder = "C:\inetpub\logs\LogFiles\W3SVC123" | |
| $LogFiles = [System.IO.Directory]::GetFiles($LogFolder, "*.log") | |
| $LogTemp = "C:\inetpub\logs\LogFiles\W3SVC123\AllLogs.tmp" | |
| # Logs will store each line of the log files in an array |
| param($AccountName) | |
| # Reset a pwd, requires reset pwd rights on the obj: | |
| Set-AdAccountPassword -Identity $AccountName -Reset -NewPassword (Read-Host -asSecureString "Enter the new password") | |
| # Change a pwd, knowing the current password | |
| Set-AdAccountPassword -Identity $AccountName -OldPassword (Read-Host -asSecureString "Enter the current password") -NewPassword (Read-Host -asSecureString "Enter the new password") |
Test-WSMan xx.xxx.xxx.xxEnable-PSRemoting$ip = "xx.xxx.xxx.xx"Set-Item WSMan:\localhost\Client\TrustedHosts "$ip" -ForceEnter-PSSession -ComputerName $ip -Credential "~\Administrator"| # all logging settins are here on top | |
| $logFile = "log-$(gc env:computername).log" | |
| $logLevel = "DEBUG" # ("DEBUG","INFO","WARN","ERROR","FATAL") | |
| $logSize = 1mb # 30kb | |
| $logCount = 10 | |
| # end of settings | |
| function Write-Log-Line ($line) { | |
| Add-Content $logFile -Value $Line | |
| Write-Host $Line |