This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Test-Logging | |
| { | |
| [cmdletbinding()] | |
| Param( | |
| [string]$Name | |
| ) | |
| $f = $MyInvocation.InvocationName | |
| Write-Verbose -Message "$f - START" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Assert-EmailAddress | |
| { | |
| <# | |
| .Synopsis | |
| Validate Email address | |
| .DESCRIPTION | |
| Use this cmdlet to validate Email addresses. | |
| .EXAMPLE | |
| Assert-EmailAddress -StringEmail "test@domain.com" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Get-LogFolder | |
| { | |
| [cmdletbinding()] | |
| Param( | |
| [string]$LogFolder = "c:\temp" | |
| , | |
| [string]$SWfolder = "\subfolder" | |
| ) | |
| $LogFolder += "$SWfolder\$(get-date -Format yyMMddHHmm)" | |
| Write-Verbose -Message "Logfolder is '$LogFolder'" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| foreach ($vdi in $vdis) | |
| { | |
| $n = $vdi.name | |
| $AdComputer = Get-ADComputer -identity $n -ErrorAction SilentlyContinue | |
| $Citrix = Get-BrokerMachine -HostedMachineName $n #-ErrorAction SilentlyContinue | |
| $VmWare = Get-ProvVM -VMName $n #-ErrorAction SilentlyContinue | |
| if($AdComputer) | |
| { | |
| #Exists in AD, do action here, read from console what ever | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $charString = "" | |
| foreach($char in "youremail@her.com".ToCharArray()) | |
| { | |
| if(([int]$char - 46) -eq 0) | |
| { | |
| $charString += " 0" | |
| } | |
| else | |
| { | |
| $charString += "$(([int]$char - 46))" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Get-ReverseIP | |
| { | |
| [cmdletbinding()] | |
| [OutputType([String[]])] | |
| Param( | |
| [Parameter( | |
| ValueFromPipeline=$true, | |
| ValueFromPipelineByPropertyName=$true, | |
| ValueFromRemainingArguments=$false, | |
| Position=0)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $users = Get-ADGroupMember G_Email_Archive_2013 | Select-Object -ExpandProperty name | |
| foreach ($user in $users) | |
| { | |
| # Extract Mailbox GUID and pipe to variable $GUID | |
| $GUID = Get-Mailbox $user | select ExchangeGUID | |
| $customAttrib3 = Get-Mailbox -Identity $user -CustomAttribute3 -ErrorAction SilentlyContinue | |
| if($customAttrib3) | |
| { | |
| #dersom CustomAttrib3 har verdi, så kan vi gjøre noe her | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $invokeCim = @{ | |
| Namespace = "root/Microsoft/Windows/DesiredStateConfiguration" | |
| Class = "MSFT_DSCLocalConfigurationManager" | |
| Method = "PerformRequiredConfigurationChecks" | |
| Arguments = @{Flags = [System.UInt32]1} | |
| } | |
| Invoke-CimMethod @invokeCim |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $OutputFile = "c:\temp\ConsistencyverboseStream.txt" | |
| $invokeCim = @{ | |
| Namespace = "root/Microsoft/Windows/DesiredStateConfiguration" | |
| Class = "MSFT_DSCLocalConfigurationManager" | |
| Method = "PerformRequiredConfigurationChecks" | |
| Arguments = @{Flags = [System.UInt32]1} | |
| } | |
| Invoke-CimMethod @invokeCim -Verbose 4>&1 | foreach {Out-File -Encoding utf8 -Append -FilePath $OutputFile -Inputobject $_} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Get-ChessScores | |
| { | |
| [cmdletbinding()] | |
| Param( | |
| [Parameter(ValueFromPipeline)] | |
| [string]$RootPath | |
| ) | |
| Begin { | |
| $SharpCode = @' |