Windows: Set network parameters from command line by using WMIC.exe

Hi,

you can use wmic.exe  to set some network parameters (and much more, its WMI!!) from command line. Syntax is very hard, but it works :-).

For Example. If you want to disable the DNS registration of all enabled Intel e1000 network adapters.

wmic path Win32_NetworkAdapterConfiguration where (IPEnabled="true" and ServiceName="E1G60") call SetDynamicDNSRegistration False,False

The Filter in the braces is the where condition of wmi “select * from NetworkAdapterConfiguration where IPEnabled=’true’ and ServiceName=’E1G60′ ” statement.  Modify this for your needs. By using WMI queries this is much more flexible than netsh command lines.

Michael

Advertisment to support michlstechblog.info

OpenVPN: Set a static IP Address for a client

Hi,

sometimes you have to set a static IP Address for some VPN Clients. Because they provide some server services which always must be reached at the same IP Address.

The client configuration do not provide any option to do that, set a static IP Address on the adapter itself is also always being overwritten when the client establish a connection to the OpenVPN server.

Solution: Define a client specific script at the server.

In this example the openvpn server’s OS is linux (tap Interface IP 10.1.134.62), the client runs at Windows (static IP 10.1.134.1).

Define a directory where the client scripts should be stored , e.g. /etc/openvpn/staticclients and create the directory

mkdir /etc/openvpn/staticclients

Add this directory as option to your openvpn configfile at the server:

client-config-dir /etc/openvpn/staticclients

For each client you have to create a file. The filename must match the “common name” attribute that was specified at the X509 certificate of the client.This command gets the CN from the computers certificate:

root@devdeb~ > openssl x509 -in /etc/openvpn/yourClientCertificate.cer -noout -subject | sed -e 's/.*CN=\(.*\)\/.*/\1/'

TESTCLIENT

This example pushs the IP Address 10.1.134.1/255.255.255.192 to the Client with the common name TESTCLIENT and also pushes a additional route for subnet 10.1.135.0.

cat /etc/openvpn/staticclients/TESTCLIENT

ifconfig-push 10.1.134.1 255.255.255.192
push "route 10.1.135.0 255.255.255.0 10.1.134.62"
# push "dhcp-option WINS addr"
# push "dhcp-option DNS addr"

Michael

Reset the print protection of a pdf document

Hi,

last week a customer had the problem that he lost a Word Document which he wants to print. Only a pdf of the document was available but in this file the print protection flag was set.

I used Ghostscript to reset the print protection.

Install Ghostscript and use this command line to write a new version of the pdf file which is printable


gswin.exe -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=d:\temp\OUTPUT.pdf -c .setpdfwrite -f D:\Temp\input.pdf

Michael

VMware: Limit the maximum number of snapshots

Hello,

in vCenter there is no global configuration parameter to limit the number of snapshots for the virtual machines. The only way is to add a limit in the vmx config file or in vCenter configuration parameters of a single virtual machine.

To set a limit of snapshots which can be taken add

snapshot.maxSnapshots = "6"
or open the configuration parameters window in vCenter and set it there.
vmware-snap-limit
Michael