PowerShell - Finding Current Script Path
Here's a useful function that will tell you the current location the script is executed from.
Research and Development
Here's a useful function that will tell you the current location the script is executed from.
Here's an one-liner that copies all commands from your command history to the clipboard.
Using System User or group names like Administrators in scripts may not always be a good idea because they are localized and may not work on machines that use a different UI language.
Here's a simple filter that will show only those files and folders that a specific user is owner of.
The Stop-Service cmdlet cannot stop services remotely. One easy way of doing so is via Set-Service.
The whoami.exe is a useful little tool that ships with Windows 7/Server 2008 R2, and it becomes even more useful when you instruct it to output its result in CSV format.
This will not hide drive letters but prohibit access to drive content. You need administrative privileges to set this setting.
Sometimes you may want to hide drive letters in Windows Explorer from users. There's a Registry key that can do this for you.
The main advantage of BITS is that it can copy things silently in the background, and it is resilient to interruptions such as reboots.
If your computer is logged on to an Active Directory, here is some code to get to your domain controllers.