How to unzip files in powershell

function Expand-ZIPFile($file, $destination) { $shell = new-object -com shell.application $zip = $shell.NameSpace($file) foreach($item in $zip.items()) { $shell.Namespace($destination).copyhere($item,16) #16 answers Y to any prompts, eg overwrite } } #call the function so: Expand-ZIPFile -file “c:\” -destination “d:\somedestination”  

Windows Environment Variables

Variable Typical value (may vary) %ALLUSERSPROFILE% C:\ProgramData %APPDATA% C:\Users\(username}\AppData\Roaming %CommonProgramFiles% C:\Program Files\Common Files %COMPUTERNAME% {computername} %COMSPEC% C:\Windows\System32\cmd.exe %HOMEDRIVE% C: or sometimes D: %HOMEPATH% \Users\{username} %LOCALAPPDATA% C:\Users\{username}\AppData\Local %PATH% Varies. Includes C:\Windows\System32\;C:\Windows\ %PATHEXT% .COM; .EXE; .BAT; .CMD; .VBS; .VBE; .JS ; .WSF; .WSH; .MSC %ProgramData% C:\ProgramData %PROGRAMFILES% Directory containing program files, usually C:\Program Files %ProgramFiles(x86)% In 64-bit …

Read more

KMS in a multi-tree forest

If you wish to create a multi-tree forest domain setup, and the root authority pays for the licenses, you only need 1 KMS server for the forest.  But the DNS service entry for KMS doesn’t replicate through the forest DSN tables by default.  To change this, make a registry change as follows (this assumes you …

Read more

Displaying Network Adapter Speed with WMI via the Win32 NetworkAdapter class

Quick little script to do the above.. Function GetNetworkSpeed(strComputer) Dim colItems, objItem, address Dim StrQuery Dim objWMIService StrQuery = “SELECT * FROM Win32_NetworkAdapter” Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\CIMV2″) Set colItems = objWMIService.ExecQuery(strQuery,,48) For Each objItem in colItems GetNetworkSpeed = GetNetworkSpeed & vbTab & objItem.ProductName & vbCr Next End Function