Showing posts with label References. Show all posts
Showing posts with label References. Show all posts

Detect Windows service status .Net

Posted by Techie Cocktail | 1:39 PM | , , | 0 comments »

Good article to detect the status of a windows service using a ServiceController class in .Net - Detect Windows Service Status

In operations team or production support team, your daily task may involve logging on to several servers to perform some analysis. Production servers allow only a certain number of users to log in at a time.

When you try login to a server where the no. of users already logged in reach the max limit, it doesn’t allow you to login. I have seen many people use 'tsadmin' console (start-> run -> tsadmin) to connect to the server and kill the unused user sessions.

There is also a command line option to view the users connected/disconnected to a particular server and kill the unused sessions – qwinsta/logoff do the command line magic.

Lets see the syntax and their usage:


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
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.

Samples
a. To check the user sessions for a remote server, the general query will be:
cmd> qwinsta /SERVER:<server_name>

See the result as below:


Here, 3 columns are important to analyze – UserName, IsD, State. UserName gives the name of the user that is connected or disconnected. In the IsD column, 0 refers to the console session, others are remote sessions. State gives the details on the connectivity status of the users. If it is Disc, you can log that user off using the logoff command.

b. Log off a particular user from a remote server
You can logoff/disconnect a user using its Session ID

cmd> logoff /SERVER:<server_name> <session_id>

These are general commands. You may read further and explore other switch options to write customized commands based on your needs.

Memory and Storage Convertor

Posted by Techie Cocktail | 11:32 AM | | 0 comments »

Came across this handy convertor tool - http://www.csgnetwork.com/memconv.html

Totals row at the end - Logparser

Posted by Techie Cocktail | 6:33 PM | , | 0 comments »

I wanted to display a totals row at the end in a Logparser query. Thought of sharing the magic.

'WITH ROLLUP' keyword does the magic.

Things to note:
'WITH ROLLUP' should be used immediately after GROUP BY clause (not after ORDER BY)

If you try to use 'ORDER BY' clause after 'WITH ROLLUP', the totals column will come in the first line but it depends on what you are sorting.

Also, if you are using Visual Logparser tool to run the query having 'WITH ROLLUP', it doesn't work and gives an error: 'Input string was not in a correct format'
But it works completely fine when run from the command line which is strange.

Example Query:
logparser "select Top 5 Date, grouping(date) as
Gdate, c-ip as IPAddress, SUM(10), count(*) as [Count] from where c-ip like 'xx.xx%' group by Date, ipaddress with rollup" -stats:off

check out the magic.

CASE Statement in Logparser Query

Posted by Techie Cocktail | 5:52 PM | , | 1 comments »

Good Logparser examples, specially the CASE Statement that helped me today.

http://technet.microsoft.com/en-us/magazine/cc160953.aspx

Flex Livedocs

Posted by Techie Cocktail | 4:30 PM | | 0 comments »

Great resource for Flex, fast upcoming language. Check it yourself at http://livedocs.adobe.com/flex/3/html/index.html

Everything about File and Stream IO

Posted by Techie Cocktail | 11:30 PM | | 0 comments »

Good source covering most of the things related to File and Stream IO in MSDN: http://msdn.microsoft.com/en-us/library/k3352a4t.aspx

References

Posted by Techie Cocktail | 1:30 PM | | 0 comments »

ASP.NET:

a. Deciding When to Use the DataGrid, DataList or Repeater: http://msdn.microsoft.com/en-us/library/aa479015.aspx#aspnet-whenusedatawebcontrols_topic5