Archive

Archive for April, 2019

[PS] Restart Exchange Services (GUI) using out-gridview

April 29, 2019 No comments

Synopsis:

Enumerates all Exchange Services, UI allows selection for restarting selected services, and reloads UI to ensure services are back running.

Change Log 1.00:
3/17/2019 – Inital pre-flight version
3/18/2019 – Added GUI, selection process, and progress bar

Read more…

Categories: Exchange, Powershell Tags:

[NET] Capture Network Trace

Capturing Network Trace

  1. Open elevated CMD
  2. Run: netsh trace start persistent=yes capture=yes tracefile=c:\temp\nettrace-boot.etl”
  3. Reproduce the issue
  4. Open elevated CMD
  5. Run: netsh trace stop

Note: For boot issues, run step 1-2, reboot* and then continue.

Converting ETL to Wireshark (.CAP)

  1. Download and install Microsoft Network Analyzer
  2. Open the ETL file
  3. Select Save as .CAP
Categories: Networking, OS Tags:

[PS] Writing errors and output to a text file

April 18, 2019 No comments

Explained:

tee (tee-object) cmdlet redirects output into two directions, stores in a file or var and sends down the pipeline. In our use, it sends to a file and also displays on console.

2>&1  construct, (stderr) 2> redirects the standard and appends the &1 (stderr to stdout) to a filename of results.txt.

Other constructs.
stdin – Standard input = 0
stdout – Standard output = 1
stderr – Standard error = 2

> – Redirect pipeline output to a file,overwriting the current contents.
>> – Redirect pipeline output to a file,appending to the existing content.
2>> – Redirect error output to a file,appending to the current contents.
2> – Redirect error output to a file,overwriting the current contents.
2>&1 – The error messages are writtento the output pipe instead of theerror pipe.

Supports PS 1.0,2.0
Supports PS 3.0+; captures only standard output

References:

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/tee-object?view=powershell-6

Categories: Powershell Tags:

[PS] Passing a string into a powershell script

April 17, 2019 No comments

Usage example:

test.ps1 revert

 

Categories: Powershell Tags:

[EXO] Enabling Mailbox on Exchange Online Hybrid Configuration (ADFS)

April 16, 2019 No comments

Enabling/Creating a Mailbox on Exchange Online in a Hybrid Configuration (ADFS)

Considerations:

  • Retention policy must be applied on the Exchange Online instead of against the on-premises AD object.

Use the New-RemoteMailbox cmdlet to create a mail user in the on-premises AD and also create an associated mailbox in Exchange Online.

Enable-Remote Mailbox is for an existing AD user.

  • remoteRoutingAddress needs to be specified to point to cloud
  • Forwarding would be set on the cloud mailbox using the cloud connection

References:

Categories: Uncategorized Tags:

[PS] Parameter with validation

April 5, 2019 No comments

Master¬† powershell’s extensibility’s use of functions is key real life application of PS scripts. Parameters are primarily known as input functions, where information can be passed and validated. Below is an example of how of passing a parameter and setting static validation sets:

Reference: https://ss64.com/ps/syntax-args.html

Categories: Powershell Tags: