Monday, July 15, 2013

Essential Command-Line Tools for Managing Active Directory

Windows Server 2008 R2 includes several tools that let you manage Active Directory from the command line. Here’s a look at the key tools and what they do.

Adprep Prepares a Windows forest or domain for installation of Windows domain controllers (DCs). To prepare a forest or a domain, use adprep /forestprep and adprep /domainprep, respectively. (Note that for Windows Server 2003 SP1 or later, a domain’s Group Policy isn’t automatically updated. To prepare Group Policy for the domain, you must use the command adprep /domainprep /gpprep. This modifies the access control entries (ACEs) for all Group Policy object (GPO) folders in the SYSVOL directory to grant read access to all enterprise domain controllers. This level of access is required to support RSoP for site-based policy. Because this security change causes the NT File Replication Service (NTFRS) to resend all GPOs to all domain controllers, you should use adprep /domainprep /gpprep only after careful planning.)

Dsadd Adds computers, contacts, groups, organizational units, and users to Active Directory. Type dsadd objectname /? at a command prompt to display help information about using the command, such as dsadd computer /?.

Dsget Displays properties of computers, contacts, groups, organizational units, users, sites, subnets, and servers registered in Active Directory. Type dsget objectname /? at a command prompt to display help information about using the command, such as dsget subnet /?.

Dsmod Modifies properties of computers, contacts, groups, organizational units, users, and servers that exist in Active Directory. Type dsmod objectname /? at a command prompt to display help information about using the command, such as dsmod server /?.

Dsmove Moves a single object to a new location within a single domain or renames the object without moving it. Type dsmove /? at a command prompt to display help information about using the command.

Dsquery Uses search criteria to find computers, contacts, groups, organizational units, users, sites, subnets, and servers in Active Directory. Type dsquery /? at a command prompt to display help information about using the command.

Dsrm Removes objects from Active Directory. Type dsrm /? at a command prompt to display help information about using the command.

Ntdsutil Allows the user to view site, domain, and server information; manage operations masters; and perform database maintenance of Active Directory. Type ntdsutil /? at a command prompt to display help information about using the command.

Saturday, July 6, 2013

SQLa0000.tmp file rapidly increases

We have noticed recently that there is a temp file in C:\windows\temp called sqla0000.tmp (c:\windows\temp\sqla0000.tmp) that continuously grows over time until it completely fills the hard drive.  It seems that the file grows gradually and then on one day it balloons to fill the entire hard drive.

 This file is associated with Symantec Endpoint Manager as you need to stop the SEPM service to delete it.

I noticed that if I restart my Symantec Embedded Database service, the file shrinks tremendously. However, I have had to do this 2 times in the past 3 months.

qla000.tmp file is consuming hard drive space


http://www.symantec.com/business/support/index?page=content&id=TECH188303

Automatically Clean Up Temporary ASP.NET Files

The Problem

One of the test environments I help maintain is subject to dynamic and regular changes in .NET applications. The development team are constantly releasing new builds that are slightly different.
You may not be aware that .NET applications go through a compilation process when they first start up. I’ve also been told on application pool recycle however I haven’t confirmed this. However, after the application has been removed or updated, the compilation temporary files remain. On a test environment similar to my above scenario, a total of 50GB of disk space can be easily wasted, doing nothing. So if you’re in a similar scenario, you may need to routinely clean up these files.
I know of four locations where these files can build up:
  • C:\Windows\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files
  • C:\Windows\Microsoft.NET\Framework64\v1.1.4322\Temporary ASP.NET Files
  • C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
  • C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files
  • C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
  • C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files
If you application pools run in 64bit mode, you’ll find the “Framework64″ locations more applicable. If your application pools use 32bit mode, you’ll need to consider the “Framework” locations.

A Few Notes

A reminder that files in these locations are normal. Don’t go over the top trying to clean them up.
It should be noted that while the files are in use by the web server, you will not be able to delete them – this is fine; the goal is to clean up unused files.
You should also be aware the next time the application fires up, on app pool start, the application will re-compile again. This may lead to a longer than average initial page load. If this is of concern, consider only removing files that are older than 30 days.
Of course, this script is provided as is. You should test it thoroughly in a test environment before use in production (though I certainly do).

Thursday, May 2, 2013

How to logoff remote desktop sessions via command line tools?

        In Windows servers, only two remote desktop sessions allowed with administrative access. There are situations, you can’t connect to the server via remote desktop because of two sessions already active.  You may have seen this dialog box. ("Remote Desktop Disconnected", "This computer can’t connect to the remote computer")

 
     Usually Windows Administrators, open "Terminal Services Manager" (in Administrative tools), connect to the problematic server and log off the unwanted sessions.  There are easy ways if you love command line based tools.

Query the Remote Server for Current Terminal Sessions

To query and list the sessions on the remote session, you could use QUser.exe or QWinst

QUser

QUser command comes with all the latest Windows clients and servers. This will list the sessions of the remote server (or local machine).

NOTE: if you are using Windows XP, you need to add this location into your System path: C:WindowsSystem32DLLCache. To do this, in command prompt, type the following.

SET PATH = %PATH%;C:WindowsSystem32DLLCache;

QUser help shows,

C:>QUser /?
Display information about users logged on to the system.

QUERY USER [username | sessionname | sessionid] [/SERVER:servername]

  username            Identifies the username.
  sessionname         Identifies the session named sessionname.
  sessionid           Identifies the session with ID sessionid.
  /SERVER:servername  The server to be queried (default is current). 

 QWinsta

QWinsta is little different and better. It has more features and options. It comes with all flavors of Windows.  QWinsta command line help displays as,

    C:>qwinsta /?
    Display information about Terminal Sessions.

    QUERY SESSION [sessionname | username | sessionid]
                  [/SERVER:servername] [/MODE] [/FLOW] [/CONNECT] [/COUNTER]

      sessionname         Identifies the session named sessionname.
      username            Identifies the session with user username.
      sessionid           Identifies the session with ID sessionid.
      /SERVER:servername  The server to be queried (default is current).
      /MODE               Display current line settings.
      /FLOW               Display current flow control settings.
      /CONNECT            Display current connect settings.
      /COUNTER            Display current Terminal Services counters information.
Logoff the Remote Sessions

To Log off the terminal session of the remote server, you can use any one of two command line tools. One of LOGOFF and another one is RWINSTA. Before you log off the remote session, you should know the "Session ID" which you get it from "QUSER" OR "QWINSTA" commands as above stated.

 Logoff

Logoff command kicks off (logging off) the specified remote session. Log off help shows,

    C:>logoff /?
    Terminates a session.

    LOGOFF [sessionname | sessionid] [/SERVER:servername] [/V]

      sessionname         The name of the session.
      sessionid           The ID of the session.
      /SERVER:servername  Specifies the Terminal server containing the user
                          session to log off (default is current).
      /V                  Displays information about the actions performed.

 RWinsta

RWinsta has same parameters and does same thing as log off command. It simply means Reset WINdows STAtion. The help goes as,

    C:>RWinsta /?
    Reset the session subsytem hardware and software to known initial values.

    RESET SESSION {sessionname | sessionid} [/SERVER:servername] [/V]

      sessionname         Identifies the session with name sessionname.
      sessionid           Identifies the session with ID sessionid.
      /SERVER:servername  The server containing the session (default is current).
      /V                  Display additional information.


Monday, April 22, 2013

View Dell Service Tags

It's not always convenient to run to the server room to try to find the Dell Service Tag on your machine, especially if you're tied to your phone on a tech support call. Here is how you can remotely find that tag.


1. C:\>wmic bios get serialnumber

Enter this into the command prompt and it will give you the Service Tag of your Dell System.
   
2. C:\>wmic /user:[username] /node:[computername] bios get serialnumber

The above command will return the Service tag for a remote computer if you don't have access to a remote desktop connection.
   
3. For Linux

dmidecode -s system-serial-number

This command will do the same thing if your box is running a Linux distrobution.

Wednesday, August 8, 2012

Download Microsoft Office 2013 Free All Versions


Download Microsoft Office 2013 Free All Versions

         Microsoft team has released the next version of Microsoft Office suite, called Microsoft Office 2013 or so called Office 365 Preview. Before, this office suite was code named as Office 15, and is now released to public for free download as Microsoft Office 2013 beta.

        Microsoft Office 2013 customer preview version comes with many new features, new metro UI and built in ability to edit pdf files. The download file available for Microsoft Office 2013 is by default offered as a basic installer and the complete package will be downloaded via network with the basic installer. But now you can get the full installer for Microsoft Office 2013 directly from Microsoft website. Check the office 2013 download files given at the end of post.

        The most surprising thing is that this version of MS Office 2013 will not support Windows XP or Windows Vista. You’ll require Windows 7 or Windows 8 to install office 2013.


Direct Download Link for Standalone Offline Installer (32-bit) (624 MB)

Direct Download Link for Standalone Offline Installer (64-bit) (702 MB)

Saturday, March 19, 2011

How To Configure ISA Proxy/Auth Setting For Yum

I was running CentOS in my LAN for my personal use and there are MS ISA servers for proxying and each user has to use his/her user name & password for Internet. So when I used my credentials in my web browser I had no problem but when I was going to do yum no success. After some googling I found this solution.

What is’NTLM Authorization Proxy Server’?

‘NTLM Authorization Proxy Server’ (APS) is a proxy software that allows you to authenticate via an MS Proxy Server using the proprietary NTLM protocol. Since version 0.9.5 APS has an ability to behave as a standalone proxy server and authenticate http clients at web servers using NTLM method. It can change arbitrary values in your client’s request header so that those requests will look like they were created by MS IE. It is written in www.python.org/” target=”_blank”>Python.

Main features:

  • supports NTLM authentication via parent proxy server (Error 407 Proxy Authentication Required);
  • supports NTLM authentication at web servers (Error 401 Access Denied/Unauthorized);
  • supports translation of NTLM scheme to standard “Basic” authentication scheme;
  • supports the HTTPS ‘CONNECT’ method for transparent tunnelling through parent proxy server;
  • has ability to change arbitrary values in client’s request headers;
  • supports unlimited number of client connections;
  • supports connections from external hosts;
  • supports HTTP 1.1 persistent connections;
  • stores user’s credentials in config file or requests password from a console during the start time;
  • supports intelligent failure detection and failover between multiple upstream proxies;

Download the ntlm rpm via your browser; because in my case Internet is working in firefox but not for yum you can also download on other pc and after that scp is the option for you.

ftp://ftp.pbone.net/mirror/ftp.sourceforge.net/pub/sourceforge/n/project/nt/ntlmaps/OldFiles/ntlmaps-0.9.9.6-1.i386.rpm

Just do copy&paste in your browser.

Open a terminal:

rpm -Uvh ntlmaps-0.9.9.6-1.i386.rpm

After that just edit server.cfg; you can find all related files by typing:

rpm -ql ntlmaps

In my case:

vi /etc/ntlmaps/server.cfg

and change the following parameters as per your requirements:
PARENT_PROXY:That_will_b_your_MS-Prosy_IP
PARENT_PROXY_PORT:That_will_b_your_MS-Proxy_Server_Port
NT_DOMAIN: That_will_b_Your_windows_Domain_name
USER:That_will_b_your_proxy-user
PASSWORD: That_will_b_your_Proxy-user_Password

Save & exit.

Now run ntlmaps deamon:

/opt/ntlmaps/main.py

You will see the following output:

NTLM authorization Proxy Server v0.9.9.6
Copyright (C) 2001-2005 by Dmitry Rozmanov, Darryl Dixon, and others.
Now listening at Testbed.abc.com on port 5865

If you see this – congratulations, you are done – otherwise troubleshoot it.

Now you have to export the proxy for yum:

http_proxy= http://127.0.0.1:5865

export http_proxy

Done!