• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Think PowerShell

Think PowerShell

PowerShell for IT Pros

  • About
    • Who I Am
    • Why I Blog
    • Privacy Policy
  • Resources
    • More PowerShell Sites
    • Post Series Index
  • Get Help
  • Show Search
Hide Search

Aaron Rothstein

PowerShell Script to Empty Recycle Bin at Logoff

Aaron Rothstein · July 6, 2016 · 3 Comments

Windows Recycle Bin
Windows Recycle Bin

Automate the emptying of the Windows Recycle Bin with this simple PowerShell script and Group Policy.

Redirected Folders = Recycle Bin Storage on File Server

In a lot of business environments, we redirect user folders like Documents, Desktops, Favorites, and more to a home directory on a network share, often mapped to its own drive letter. The folders are then synced to the user’s workstation to be available offline. This gives the user the ability to work on the files when disconnected, but still allows IT to have the files stored on the file servers and backed up.

[Read more…] about PowerShell Script to Empty Recycle Bin at Logoff

PowerShell Replacement for ‘nslookup’

Aaron Rothstein · March 2, 2016 · 9 Comments

nslookup options screenshot

The fourth post in my PowerShell Beginner series, “Daily Tasks, The PowerShell Way“. Use PowerShell’s Resolve-DnsName cmdlet as a more powerful successor to ‘nslookup’.

What’s in a name?

Any seasoned IT Pro knows that the names we see for servers or in web URLs ultimately need to “resolve” or translate to a numerical IP address. Computers perform this resolution using a worldwide network of Domain Name System (DNS) servers. When your browser attempts to go to https://thinkpowershell.com, your computer will send a query to a DNS server with the hostname “thinkpowershell.com”, and the DNS server will return the IP address of the server hosting the website. Your DNS server will likely have to forward a query to other DNS servers to get the correct IP address.

nslookup (name server lookup) is a command line tool that has been around for years for performing this lookup activity on demand. You can specify the hostname or website domain name for which you want to “lookup” the IP address. Additionally, with the second positional parameter you can specify the IP address of a specific DNS server you want to query. It is a helpful tool, but it only returns CNAME , A, and AAAA record information, and not as a script-usable object.

[Read more…] about PowerShell Replacement for ‘nslookup’

PowerShell Replacements for ‘ipconfig’ Client DNS Functions

Aaron Rothstein · February 29, 2016 · Leave a Comment

Screenshot of ipconfig DNS functions.

The third post in my PowerShell Beginner series, “Daily Tasks, The PowerShell Way“. Use PowerShell to replace ipconfig‘s /registerdns, /displaydns, and /flushdns functions, and use for both local and remote computers.

ipconfig: a longtime member of the IT Pro toolbox

Much like ping, ipconfig was a frequently used command line tool for IT Pros. Whether it was getting assigned IP information, releasing and renewing DHCP leases, or investigating DNS client issues, ipconfig was quick go to troubleshooting tool. However, recent versions of Windows and PowerShell have added easy to use cmdlets to replace some of these functions. This post will take a look at the cmdlets related to the DNS client.

[Read more…] about PowerShell Replacements for ‘ipconfig’ Client DNS Functions

Configure Static IP Address or DHCP

Aaron Rothstein · February 23, 2016 · 3 Comments

Windows 10 network connections screenshot.

The second post in my PowerShell Beginner series, “Daily Tasks, The PowerShell Way“. Learn how to get network connection information and configure a static IP or DHCP using PowerShell.

Are you connected?

In my previous post we covered how to use Test-NetConnection for network connectivity troubleshooting. If you connected to a DHCP enabled network, you will likely have successful tests without any action on your part. However, if your network environment requires static configuration of IP addresses and DNS servers for servers and/or workstations, you need to configure the correct network settings for a newly provisioned computer.

[Read more…] about Configure Static IP Address or DHCP

Add Script Flexibility with Relative File Paths

Aaron Rothstein · February 15, 2016 · 11 Comments

Folder Contents Screenshot

Using relative file paths for your PowerShell script’s supporting files ensure it continues to work when the script and files get moved around. Here’s how.

Unpredictable File Paths

My first intensive use of PowerShell was for scripting software installations/configurations in SCCM packages. It seemed like every situation called for something above and beyond a straightforward MSI install.

I would develop and test the SCCM package on my local system with a sandbox VM prior to deploying in SCCM. The SCCM client would then download that package to a cached location on each individual client. From development to deployment, I couldn’t guarantee the absolute file path of my script and any supporting files would be constant. I needed my script to be able to figure out where the supporting files were in relation to itself.

[Read more…] about Add Script Flexibility with Relative File Paths

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 8
  • Page 9
  • Page 10
  • Page 11
  • Page 12
  • Go to Next Page »

Primary Sidebar

Aaron

Think PowerShell

Copyright © 2025 · Monochrome Pro on Genesis Framework · WordPress · Log in