- 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.
- 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
.
- 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")
- 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:
Command Line
Powershell
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:
Command Line
Windows OS-Level Issues
We can do this:
powershell "& {set-netfirewallprofile -profile domain,public,private -enabled 1}" -command
Anything placed after -command
is treated as an argument.
Categories:
Command Line
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:
Command Line
Windows OS-Level Issues
Lots of interesting things here:
http://code.google.com/p/googlecl/
including, just for starters, command-line upload to Youtube.
Categories:
Command Line
Tools
Categories:
Command Line
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:
Audio-Video
Command Line
For Server 2003 SP2 and up, we have something new, ICACLS . Here’s some docs:
http://ss64.com/nt/icacls.html
Categories:
Command Line
Windows OS-Level Issues
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:
Application Issues
Command Line
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:
Command Line