Skip to content

Instantly share code, notes, and snippets.

@BartVandyck
Last active October 4, 2016 17:59
Show Gist options
  • Save BartVandyck/309f02566194efa57139 to your computer and use it in GitHub Desktop.
Save BartVandyck/309f02566194efa57139 to your computer and use it in GitHub Desktop.

Generate a temporary file name

>  [System.IO.Path]::GetTempFileName()

Resolve a host name to it's FQDN

>  [system.net.dns]::resolve($env:computername)

>  [system.net.dns]::resolve($env:computername).host  #Return the FQDN only

Show hidden files and folders

> Get-ChildItemHidden

> Get-ChildItem –Attributes H

Clear recycle bin

> #Requires PowerShell Version 5
> Clear-RecycleBin –DriveLetter C -force

Add CTMF Modules to a script

>  Import-Module $PSScriptRoot\CTMF-Modules\ctmf-core.psm1 -force

Test TCP Open port

>  (new-object system.net.sockets.tcpClient).connect("computername",80)

If no error is returned the port is accessible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment