19 March 2019

Capture network traffic without installing 3th party tools


1. in an elevated command prompt window run:
    netsh trace start persistent=yes capture=yes tracefile=c:\temp\tcpdump.etl
2. reproduce the issue (can also do a reboot of the computer - the traffic will be captured)
3.  in an elevated command prompt window run:
    netsh trace stop


It will also capture while restarting (until netsh trace stop)

25 May 2018

Find filesystem blocksize on windows with powershell

Get-WmiObject -Class Win32_Volume | Select-Object Name, Label, BlockSize

Get-CimInstance -ClassName Win32_Volume | Select-Object Name, Label, BlockSize

22 May 2018

Find exception full name

$Error[0] | Select-Object *

Exception  : Microsoft.ActiveDirectory.Management.ADIdentityAlreadyExistsException: The specified account already exists



$Error[0].Exception.GetType().FullName
Microsoft.ActiveDirectory.Management.ADIdentityAlreadyExistsException

14 March 2018

Exchange 2016 cmdlet help

help is broken in Exchange 2016 PowerShell console - the only way to make it work i found to be this:


$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://exchangeservername/PowerShell/?SerializationLevel=None

Invoke-Command –Session $Session –ScriptBlock {Get-Help Get-Mailbox}

but you will not be abble to import the exchange cmdles through this pssession because it will throw an error.

to import the cmdlest you need to have a different pssession without "SerializationLevel=None"


$Session2 = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://exton.office.orange.intra/PowerShell
Import-PSSession $Session2

02 March 2018

Get-WmiObject hangs

for some reason Get-WmiObject hangs on some of the computers that is queryes and the powershell console must be restarted.

in order to overcome this problem a used "-AsJob" parameter


$Job = Get-WmiObject -Class win32_computersystem -AsJob -ComputerName ServerName | Wait-Job -Timeout 30
$Result = $Job | Receive-Job