Wget in PowerShell v3

I've been envying my *nix brethren for having Wget for a long time. To get the contents of a web page or download a file using http I had to use workarounds that took more than one command - either creating a new System.Net.WebRequest or using a BITS module …

more ...

Copying Files In PowerShell - Using Windows Explorer UI

I know this trick is widely known, but I thought it's worth mentioning anyway.
If you use PowerShell's Copy-Item to copy files, you don't get any progress report, ETA or statistics like you do when using Windows Explorer's file copy.

First, let's generate a random file using fsutil. Note how …

more ...

Testing actual SMB version

Ever since I got employed in my present company, I've been told that our NetApp Filer supports SMB2 when used as NAS.
I was always skeptic of that (due to high transfer times and being unable to cancel mid-file) but had no easy way of testing (I guess I could …

more ...

Mass Setting Permissions on Remote Shares

I was recently asked by one of my teammates to add several NTFS permissions to the root folders of a bunch of shares. Seems easy, but I had two problems:

  1. The shares were stored on a NetApp Filer, so I couldn't use any WMI trickery (or the new SMB module …
more ...

Copying List Permissions in SharePoint 2010

I just wrote a small script to copy permissions from one SharePoint list to the other.

Things to consider

  • Custom permission levels are not preserved: For some reason, my method of copying permissions isn't custom-permission-level friendly. The customized permissions will still be copied, but an auto-generated permission level will be …
more ...

Finding WSUS Clients by SusClientId

Today someone showed me a strange problem - he had servers that recently installed new updates from his WSUS server, but he couldn't find them in the WSUS console by their name.
Obviously the servers have been renamed and didn't have time to report to the WSUS server, but he wanted …

more ...

Making Sure Only Your PDC is Scavanging DNS Records

I recently looked over out DNS server settings, and I found out that more than one DNS server (DC in our case) was scavenging records.
In order to put that right, I made a small script that makes sure that only the PDC is scavenging records:

param(
 $scavengeInterval = 7
)

Get-ADDomainController …
more ...

Brute Force Guessing for User Passwords

Our security team complained to me that they found a lot of users with trivial passwords simply by trying to log in as them.
They asked me to write them a script to speed up the process, so I wrote them my brute force guessing script.
It's not very stealthy …

more ...

Automaticlly Updating DNS Server Addresses In A Domain Machine

The Problem

I was recently requested to make sure that our machine's network interface cards (NICs) have their DNS queries pointed to "the correct servers".
I decided that every machine should point to its domain's DNS servers, and it's their job to redirect queries (if needed) to other DNS servers …

more ...

Applying SPWebConfigModification objects safely

My SharePoint team and I wanted to move to SPWebConfigModification rather that just modifying the web.config file manually, but I was always worried that applying faulty modifications will ruin my file.
Why?

How SPWebConfigModification objects work

Some code requires you to modify the SharePoint web application's web.config file …

more ...