Category: Command Line

Set DNS in use via Powershell
article #1490, updated 39 days ago

  1. Open up an administrative Powershell. Run IPCONFIG /ALL. That will get you a list of active NICs. DNS in use, is set for each NIC if you have more than one.
  2. The name of each NIC has a prefix that has to be omitted. There are a number of prefixes which are common. For a simple wired NIC, it’s usually “Ethernet Adapter”; on many HPE servers, IPCONFIG /ALL will therefore show the second NIC as Ethernet adapter Embedded LOM 1 Port 2.
  3. So let’s say you have a LAN with three active DNS servers (10.11.12.13, 10.11.12.14, and 10.11.12.15), and you want your HPE server of the above description, with the first two NICs active, to use all of them. Here’s the Powershell commands:
Set-DnsClientServerAddress "Embedded LOM 1 Port 1" -ServerAddresses ("10.11.12.13","10.11.12.14","10.11.12.15")
Set-DnsClientServerAddress "Embedded LOM 1 Port 2" -ServerAddresses ("10.11.12.13","10.11.12.14","10.11.12.15")
  1. For a second example, let’s say we’re on a common workstation, and we want to change DNS from a static setting, to whatever DHCP will pass out:
Set-DnsClientServerAddress "Ethernet" -ResetServerAddresses

Categories:      

==============

Files piling up in C:\ProgramData\Microsoft\Crypto\RSA\S-1-5-18
article #1100, updated 1893 days ago

When certain antivirus products go a bit haywire, or other unfortunate things happen, hundreds of thousands of small files can pile up in either the location in the title of this article, or here:

C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys

The location in the title seems to be more common in Windows 10, the other more for Windows 7, but check both, and if you have a pileup in either, run this CMD command inside:

forfiles /D -10 /C "cmd /C attrib -s @file & echo @file & del @file"

forfiles is a very nice command that iterates through the files in a folder according to its parameters. /D -10 iterates through all files more than 10 days old. attrib -s takes off the System attribute, which is needed for DEL (delete) to work. The echo is there so you can see that it is doing its job.

Categories:      

==============

Embed PowerShell in a CMD command
article #1097, updated 1893 days ago

We can do this:

powershell "& {set-netfirewallprofile -profile domain,public,private -enabled 1}" -command 

Anything placed after -command is treated as an argument.

Categories:      

==============

Set a user's password to non-expiring via CMD
article #731, updated 3008 days ago

NET USE does not appear to be able to set a user’s password to non-expiring. However, we do have this:

WMIC USERACCOUNT WHERE "Name='username'" SET PasswordExpires=FALSE

Categories:      

==============

Google command line tools
article #593, updated 3364 days ago

Lots of interesting things here:

http://code.google.com/p/googlecl/

including, just for starters, command-line upload to Youtube.

Categories:      

==============

Excellent reference to CMD, Bash, PowerShell, Microsoft SQL, and several other command line environments
article #574, updated 3412 days ago

Try this:

http://ss64.com

Categories:      

==============

Command-line DVD pre-preparation
article #285, updated 4225 days ago

The following converts a huge variety of video formats (replace .ABC with whatever you have, AVI, FLV, etc.) to DVD-compatible MPEG:

ffmpeg -i videofile.ABC -target dvd -aspect 16:9 -sameq videofile.mpg

FFMPEG is standard in probably all non-minimalist Linux distros, and can also be had for Windows now.

Categories:      

==============

File and folder permissions from the command line
article #219, updated 4425 days ago

For Server 2003 SP2 and up, we have something new, ICACLS .  Here’s some docs:

http://ss64.com/nt/icacls.html

Categories:      

==============

Convert PDF to TIFF with free software (Ghostscript)
article #216, updated 4431 days ago

Here is a valid command line:

gswin32c -q -dNOPAUSE -sDEVICE=tiffg4 -sOutputFile=output.tif input.pdf -c quit

A good place to get Ghostscript for Windows is here:

http://sourceforge.net/projects/ghostscript/

Categories:      

==============

Command-line creation of Windows shares
article #74, updated 5073 days ago

Here is some info on creation of Windows shares by command-line. It involves a free download from Microsoft called RMTSHARE.


http://windowsitpro.com/articles/index.cfm?articleid=74678

Categories: