Showing posts with label Cmd Line. Show all posts
Showing posts with label Cmd Line. Show all posts

Monday, 21 December 2015

Rename website, virtual directory and/or application in IIS 7, 8, 8.5

There is no way to rename a newly created website and an application running beneath via the GUI.
You'd have to delete and recreate your entire site to be able to correct any issue.
However it can be performed from the command line using the appcmd.exe tool.

Start CMD Prompt and ensure you “Run as Administrator” and use the following commands:
                    cd C:\Windows\SysWOW6\inetsrv\
                    appcmd set site ExistingSiteName -name:NewSiteName
Done!
If you need to rename a Virtual Directory
appcmd set VDIR “Default Web Site/oldVDirName” -path:/newVDirName
For Applications under that virtual directory.
 appcmd set APP “Default Web Site/oldVDirName/MyApplication” -path:/newVDirName/MyApplication
To test run the following command to list results.
appcmd list Site
appcmd list VDIR
appcmd list APP

Tuesday, 17 November 2015

Force reboot a crashed linux server

force a reboot in linux

if a server is still reachable via ssh, then a reboot can be forced:
 echo b > /proc/sysrq-trigger

Force a network drive to disconnect in Windows with NET USE /delete

An undocumented switch exists to force to disconnect a network drive using NET USE :
NET USE K: /DELETE /YES
The /YES switch forces the disconnection, also if files are open, the disconnect succeeds without promting the user.
Without this the user will be prompted yes / no to continue

Tuesday, 22 September 2015

View Currently Executing Requests in a Worker Process

When you notice that a worker process is using many resources on your Web server, or requests are taking a long time to process, you can view a list of current requests that are processing in a specific worker process. 

This information can help you determine where a problem occurs in a specific area of a site or application. 

You can view which requests are currently processing in the worker process, and then use that information to investigate why a certain request takes so much time to process.


The currently executing request information in IIS Manager returns the following information about requests in a worker process:
  • Site ID. The site identifier (ID) for the specific request.
  • Url. The requested Uniform Resource Locator (URL).
  • Verb. The Hypertext Transfer Protocol (HTTP) verb used in the request.
  • Client IP. The Internet Protocol (IP) address of the client who made the request.
  • State. The current pipeline module state that the request is in.
  • Module Name. The current module that the request is in.
  • Time Elapsed. The period of time the request has been in process.

Via the GUI



Open IIS Manager. 
In the Connections pane, select the server node in the tree.
In Features View, double-click Worker Processes.
Select a worker process from the grid.
Click View Current Requests in the Actions pane.
View the list of requests in the grid.

Via the Command Line

cd Windows\System32\inetsrv

appcmd list requests - show all current requests 
appcmd list requests /elapsed:4000 - show all current requests taking longer than 4 seconds to execute

Setting Environment Variables in Windows

Environment variables hold values related to the current environment, like the Operating System or user sessions.



Setting Environment variables via the GUI

  1. Open Control Panel » System » Advanced » Environment Variables.
  2. Type control sysdm.cpl,,3 in the Run dialog (Win+R) and click Environment Variables.
    For editing user variables you can also type
    %windir%\System32\rundll32.exe sysdm.cpl,EditEnvironmentVariables
    
    in the Run dialog.
  3. Right-click (My) Computer and click on Properties, or simply press Win+Break.
    • In XP click on Advanced » Environment Variables.
    • In Vista+ click on Advanced system settings » Environment Variables.
  4. There are many other ways of reaching the same place, such as by typing "environment variables" in the Start Menu/Screen search box and so on.
Environment variables in Windows are separated into user and machine/system specific values. You can view and edit their values there. Their current values upon launch are made available to all programs.

Setting Environment variables via the Command Line

Format

Environment Variables in Windows are denoted with percent signs (%) surrounding the name:
%name%

echo

To display an environment variable's value in cmd.exe, type echo %name%.
C:\>echo %USERPROFILE%
C:\Users\Daniel

set

To create/set a variable, use set varname=value:
C:\>set FunnyCatPictures=C:\Users\Daniel\Pictures\Funny Cat Pictures

C:\>set FunnyCatPicturesTwo=%USERPROFILE%\Pictures\Funny Cat Pictures 2
To append/add a variable, use set varname=value;%varname%:
C:\>set Penguins=C:\Linux

C:\>set Penguins=C:\Windows;%Penguins%

C:\>echo %Penguins%
C:\Windows;C:\Linux
Environment variables set in this way are available for (the rest of) the duration of the Command Prompt process in which they are set, and are available to processes that are started after the variables were set.

setx

To create/set a variable permanently, use setx varname "value":
C:\>setx FunnyCatPictures "C:\Users\Daniel\Pictures\Funny Cat Pictures"

[Restart CMD]

C:\>echo %FunnyCatPictures%
C:\Users\Daniel\Pictures\Funny Cat Pictures
Unlike set, there is no equals sign and the value should be enclosed in quotes if it contains any spaces. Note that variables may expand to a string with spaces (e.g., %PATH% becomes C:\Program Files), so it is best to include quotes around values that contain any variables.

List of Windows Environment Variables

Here is a list of default environment variables, which are built into Windows. Some examples are:%WINDIR%%SystemRoot%%USERPROFILE%, and %APPDATA%. Like most names in Windows, these are case-insensitive.