Howtos / Articles

Display Total Folder Size with PowerShell and Sort by Size

The PowerShell command below can be used to display a list containing the total size (in MB) of all the files and folders (recursively) in the current directory, and sort them by total size. ls -Force | Add-Member -Force -Passthru -Type ScriptProperty -Name Length -Value {ls $this -Recurse -Force | Measure -Sum Length | Select -Expand Sum } | Sort-Object Length -Descending | Format-Table @{label=”TotalSize (MB)”;expression={[Math]::Truncate($_.Length / 1MB)};width=14}, @{label=”Mode”;expression={$_.Mode};width=8}, Name Sample Output: TotalSize (MB) Mode Name ————– —- —- 26499…

Read more [...]

PowerShell Command to Recursively Delete Thumbs.db

The PowerShell command below can be used to remove thumbs.db files from the current folder, and all sub folders. Make sure you change directory ‘cd’ into the folder you want the command to run from. Get-ChildItem -Path . -Include Thumbs.db -Recurse -Name -Force | Remove-Item -Force You can change the ‘-Include’ parameter to any wildcard you like, such as *.tmp or *.bak for example. Get-ChildItem -Path . -Include *.tmp -Recurse -Name -Force | Remove-Item -Force Remove the ‘Remove-Item’ statement to…

Read more [...]

Sticky Session Load Balancing with HAProxy

HAProxy provides a number of methods for maintaining a record of which backend server should handle a specific connection. This is known as creating a ‘sticky’ connection (other terms for this are ‘connection persistence’ and ‘connection affinity’). HAProxy can use the source ip address, url hash, cookies, sessions (checks cookies and url parameter), headers, and more, to determine which backend server to pass the connection to. Add one of the following lines to the HAProxy config file, in the section…

Read more [...]

Rewrite a http request to https with nginx

If you have a web server running nginx that accepts both http and https connections, there may be times where you want to prevent anyone from accessing a specific page/url using a insecure http connection. For example, login or registration pages. You always want these to be secure if you can. Add the following into the main “location /” block, located in the http “server” section in your nginx configuration file for your site. if ($request_uri ~* “/login.php”) { rewrite…

Read more [...]

Reboot a Cisco 7940/7960 series handset

To reboot a Cisco 7940 / 7960 serial VOIP handset without unplugging the power brick (or the ethernet port when using PoE / Power Over Ethernet), you can press the following three button combination: [*] + [6] + [Settings] The “Headset” button light will light up briefly and then turn off, then the same thing will occur with the “Mute” button light, and then finally the same will occur with the “Speaker” button light. The phone will then reboot. This…

Read more [...]

Page 21 of 39« First...10...17181920212223242526...Last »