Sunday, 7 February 2016

Process Model Settings for an Application Pool

To set an AppPool to run under a different user, in poqwershell :

Set-ItemProperty IIS:\AppPools\MyAppPool -name processModel.identityType -value X

Where X =
0 = LocalSystem
1 = LocalService
2 = NetworkService
3 = SpecificUser
4 = ApplicationPoolIdentity

http://www.iis.net/configreference/system.applicationhost/applicationpools/add/processmodel

List all IIS Web Applications with the .net version, the state of the Web Application and the assigned user/identity.

List all IIS Web Applications with the .net version, the state of the Web Application and the assigned user/identity.

try{
Import-Module WebAdministration
Get-WebApplication

$webapps = Get-WebApplication
$list = @()
foreach ($webapp in get-childitem IIS:\AppPools\)
{
$name = "IIS:\AppPools\" + $webapp.name
$item = @{}

$item.WebAppName = $webapp.name
$item.Version = (Get-ItemProperty $name managedRuntimeVersion).Value
$item.State = (Get-WebAppPoolState -Name $webapp.name).Value
$item.UserIdentityType = $webapp.processModel.identityType
$item.Username = $webapp.processModel.userName
$item.Password = $webapp.processModel.password

$obj = New-Object PSObject -Property $item
$list += $obj
}

$list | Format-Table -a -Property "WebAppName", "Version", "State", "UserIdentityType", "Username", "Password"

}catch
{
$ExceptionMessage = "Error in Line: " + $_.Exception.Line + ". " + $_.Exception.GetType().FullName + ": " + $_.Exception.Message + " Stacktrace: " + $_.Exception.StackTrace
$ExceptionMessage
}



the output is a table:
WebAppNameVersionStateUserIdentityTypeUsernamePassword
Web123v2.0StartedSpecificUsertest\webuserP@55w04D

From : https://melcher.it/2013/03/powershell-list-all-iis-webapplications-net-version-state-identity/

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

Show unused / disconnected devices in Device Manager

Normally the device manager only shows currenly loaded and in use drivers and devices.

This makes removing none connected devices and unused drivers difficult.



from windows, run cmd.exe, type: set devmgr_show_nonpresent_devices=1


Then start devmgmt.msc
From the gui select "View" -> "Show hidden devices"
now you can delete non-used drivers /devices.

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

Wednesday, 23 September 2015

Graceful Logoff from a Published Application Renders the Session in Active State

Taken from : http://support.citrix.com/article/ctx891671

Symptoms or Error

Graceful logoffs from a published application launched in a seamless, fixed window, or as an RDP Initial Program, might result in the session not closing and the user being logged off. Sessions can be reset or exited correctly by manually resetting them, or by terminating remnant user processes in Terminal Services Administration, the Management Console, or Access Suite Console.

Solution

Complete the following steps:
  1. Determine if the application in question and its associated processes correctly exit on a windows workstation outside of a Terminal Services environment.
  2. If they do not, then it is possible that this mechanism might not work or it might be necessary to contact the application manufacturer.
  3. Add the process file name to the following registry key:
    Caution! Refer to the Disclaimer at the end of this article before using Registry Editor.
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Citrix\wfshell\TWI
    Value Name:LogoffCheckSysModules
    Type:REG_SZ
    String:MyAppName.exe
Notes:
  • Do not place the executable name of the main published application in this key because this might result in failure to properly launch the published application. There is an issue if the main executable for the specified published application is not terminating correctly.
  • Do not place the executable name of a secondary process that has a visible window in this key. This mechanism is designed to exit secondary processes that do not have a visible window, as it is expected that if an application window is visible, then it is intended for the user to see it, and therefore close it themselves.
    The application might not appear to present a visible window or a system tray icon in a seamless session. Run the application in a fixed window, perform the function within the application that spawns the secondary process and minimize the main application window. The spawned window is displayed in the background. An RDP initial application session configured on the RDP listener exhibits the same behavior. If a customer uses a logoff script, the logoff script could be used to check for the spawned process and terminate the process. Ideally, the application should close all child process that it spawns.
  • Enter the list of executable names with a comma and NO spaces between them, for example:
    App1.exe,app2.exe,app3.exe