Showing posts with label cmd. Show all posts
Showing posts with label cmd. Show all posts

2016-03-30

Tool: How to get IBM MPIO disk UID from cmd

Some times we can have many different disks from different vendors connected to several servers, and to avoid such complexity we need general identity to identify disk on all OS, applications equally.

How to obtain IBM MPIO disk UID from Windows Server where is attached IBM SAN disk?
Run the sample by opening a Command Prompt window in catalog IBM MPIO <C:\Program Files\IBM\SDDDSM> (make sure already IBM Subsystem Device Driver Device Specific Module (SDDDSM) is installed ) and typing the following command at the command prompt:

datapath query device

In cmd output find  32 digits long number after word SERIAL and that number is your UID.


/Geecoholic

2016-03-25

Windows 2008 R2: Multiple IP's on single netwotk interface and how to change outgoing IP

I have Windows 2008 R2 server with single network interface and ip 10.10.10.17. On server runing multiple services like sql, sftp, http, https, file server. Today i added additional ip adress 10.10.10.10 and assigned only to web services, but after some time noticed that 10.10.10.10 ip are used in other services as outgoing ip. Ipconfig /all command show 10.10.10.10 ip  "above" 10.10.10.17:

Ethernet adapter INTRANET:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection #2
   Physical Address. . . . . . . . . : 00-0C-EE-EE-EE-EE
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   IPv4 Address. . . . . . . . . . . : 10.10.10.10(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.224
   IPv4 Address. . . . . . . . . . . : 10.10.10.17(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.224
   Default Gateway . . . . . . . . . : 10.10.10.1
   DNS Servers . . . . . . . . . . . : 10.10.10.11 10.10.10.12
   NetBIOS over Tcpip. . . . . . . . : Enabled



Looks like Windows Server 2008 R2 use for outgoing traffic closest to GW ip.
Problem solved  using cmd commands:

netsh interface ipv4 delete address "INTRANET" 10.10.10.10
netsh interface ipv4 add address "INTRANET" 10.10.10.10 255.255.255.224 skipassource=true


Ipconfig /all after fix:

   IPv4 Address. . . . . . . . . . . : 10.10.10.17(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.224
   IPv4 Address. . . . . . . . . . . : 10.10.10.10(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.224


/Geecoholic

2016-03-17

Cmd: I'm local administrator?

How to check if current logged in user has local administrator rights.

Run the sample by opening a Command Prompt window and typing the following command at the command prompt:

whoami /groups | find /i "BUILTIN\Administrators"


If any string is returned, yes you are Administrator!

/Geecoholic

2016-03-07

Logoff all users from Windows RDS/Terminal Server using cmd

How to logoff all users in server except administrator? Save sample below to a file named userslogoff.cmd to c:\temp directory:

query session |find /i "tcp#" | find /v /i "administrator" >session.txt
for /f "skip=1 tokens=3," %%i in (session.txt) DO logoff %%i
del session.txt


Run the sample by opening a Command Prompt window and typing the following command at the command prompt:

cd\
cd temp
userslogoff.cmd


Logoff command do not prevent uses for new logins, use command to disable new logins:

change logon /disable


Logons are re-enabled when you restart the system or use command to enable:

change logon /enable


/Geecoholic

2016-03-02

Tool: How to expand Windows 2003 partition without server restart

I know that Windows 2003/XP is very old, not more supported by MS, they have many security holes and more blablabla, but they still exist and we need powerful tools for online partitions(particularly system) expand like in Windows 2008/2012/10.

Good news is such tool for command prompt ExtPart.exe exist on Dell support site: Dell Basic Disk Expansion.

Official MS KB for expansion with build-in tools if you want try in MS way before Dell.

/Geecoholic

2016-02-28

VBScript: How to get needed Windows updates count

Save sample below to a file named NeededUpadatesCount.vbs:

Set updateSession = CreateObject("Microsoft.Update.Session")
updateSession.ClientApplicationID = "Geecoholic Script"

Set updateSearcher = updateSession.CreateUpdateSearcher()

WScript.Echo "Searching for updates..." & vbCRLF

Set searchResult = _
updateSearcher.Search("IsInstalled=0 and Type='Software' and IsHidden=0")

WScript.Echo "Updates Count: " & searchResult.Updates.Count
WScript.Quit


 You can run the sample by opening a Command Prompt window and typing the following command at the command prompt:

script NeededUpadatesCount.vbs

Script made using example from MS link

/Geecoholic

2016-02-27

Windows OS disk backup from cmd

How to make Windows OS/System disk (C:) and related boot partitions backup using Command prompt:

WbAdmin start backup -backupTarget:W: -include:C: -allCritical -quiet

where W: is removable USB or other disk. W: can be replaced to network path \\server\backup

/Geecoholic