Tag: Powershell

Powershell command to find all DNS resolvers for all interfaces

by on May.29, 2025, under Computer Stuff, General Info, Windows Info

This will find and return the DNS resolvers for all populated interfaces, excluding loopback:

Get-DNSClientServerAddress | Where-Object {($_.ServerAddresses -notlike "{}" -and $_.InterfaceAlias -notlike "Loopback*")}

Leave a Comment : more...

Self-signed certificate that lasts 5 years

by on Mar.02, 2022, under Computer Stuff, General Info, Windows Info

On modern Windows servers, you can create a self-signed certificate with powershell, using the new-selfsignedcertificate command. By default, this certificate will only last for 1 year before expiring. To create a certificate that lasts a little longer, fire up an admin powershell, and do this:

$fromtoday = get-date
$5years = $fromtoday.addyears(5)
new-selfsignedcertificate -dnsname mycertname.mydomainname.com -notafter $5years -certstorelocation cert:\localmachine\my

31
Leave a Comment :, more...

Find External NAT Address using powershell

by on Dec.21, 2021, under Computer Stuff, Networking, Windows Info

Sometimes, you need to know the external NAT address, but you can’t take over the console of the computer.

So, fire up powershell in the background, and run this command:

(Invoke-WebRequest -UseBasicParsing ifconfig.me/ip).Content.Trim()

 

 

Leave a Comment :, , more...

Find users connected to all network shares

by on Dec.03, 2021, under Computer Stuff, Windows Info

Needed this to determine which DFS namespaces that users were connecting to.

Get-WmiObject Win32_ServerConnection -ComputerName SERVERNAME | Select-Object ShareName,UserName,ComputerName

Leave a Comment : more...

Find and delete a file on ALL drives using powershell

by on May.05, 2021, under Computer Stuff, Windows Info

In the example below, replace filename.txt with the file you’d like deleted. It will be removed from all drives.

get-psdrive -PSProvider filesystem | ForEach-Object { Get-Childitem -Path $_.Root -Filter filename.txt -recurse | Remove-Item -force}

1 Comment :, more...


Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

CryptedNets is proudly powered by

Entries (RSS) and Comments (RSS)
- Login

Visit our friends!

A few highly recommended friends...