Showing posts with label Windows System Admin. Show all posts
Showing posts with label Windows System Admin. Show all posts

Wednesday, January 27, 2016

usb showing shortcuts only

attrib -h -r -s /s /d g:\*.*

attrib -h -r -s /s h:\*.*

Friday, January 22, 2016

microsoft excel cannot open or save any more documents because there is not enough available memory



at Control Panel \ All Control Panel Items \ Default Programs \ Set Default Programs \ Set Program Associations



In Excel, go to File/Options/Trust Center/Trust Center Settings/Protected View. Untick the "Enable Protected View for Outlook Attachments" - and all will be well.


no mapping between account name and security ids was done server 2008 service installation

 grant rights of folder

If you do choose the SYSPREP route though here is what you need to do:
From the Start Menu select Run
Enter C:\Windows\System32\sysprep\sysprep.exe in the box and click OK
Be sure that Enter System Out-of-Box Experience (OOBE) is selected
Check the box next to Generalize (If this is not select the SID won’t get changed)
Click OK and follow the prompts when the system reboots.


C:\Windows\System32\sysprep\sysprep.exe

Friday, August 10, 2012

Excel Security Settings using Command / ASP.NET code


cmd>reg add "HKCU\Software\Microsoft\Office\12.0\Excel\Security" /v AccessVBOM /t reg_dword /d 1 /f


Microsoft.Win32.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security", "AccessVBOM", "1",RegistryValueKind.dWord)

Windows Regional settings using command or in ASP.NET code


cmd> REG ADD "HKCU\Control Panel\International" /v sShortDate /d "dd/MM/yyyy" /f


Microsoft.win32 Namespace is containing register class; Register class is used to manipulate the system registry. It represents a Key level node in the windows registry.

Microsoft.Win32.Registry.SetValue("HKEY_CURRENT_USER\Control Panel\International", "sShortDate", "dd/MM/yyyy")

====================

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Microsoft.Win32.Registry.SetValue("HKEY_CURRENT_USER\Control Panel\International", "sShortDate", "dd/MM/yyyy")

End Sub




Friday, June 1, 2012

IIS Performance Tuning


1)     Recycling Application Pool

Daily they have to restart IIS to clear the application pool.

An application pool is a set of one or more applications assigned to a set of one or more worker processes.

It is useful to recycle periodically because web apps might have a memory leaks or other conditions that get worse over time.

Schedule a recycle application pool once a day on off-peak hours. 



cid:image002.jpg@01CD3FFB.20EDA9C0

cid:image007.jpg@01CD3FFB.20EDA9C0

2)     Dedicated Application Pool for different applications

cid:image008.jpg@01CD3FFB.20EDA9C0

3)     Web Garden on IIS (Max Worker process) Allocate worker process to different CPU core
By default each Application Pool runs with a Single Worker Process (W3Wp.exe). We can assign multiple Worker Processes With a Single Application Pool. An Application Poll with multiple Worker process is called "Web Gardens". Many worker processes with the same Application Pool can sometimes provide better throughput performance and application response time. And each worker process should have their own Thread and Own Memory space.

Application Pool > Max Worker process

cid:image003.jpg@01CD400F.ADF00D90

 IIS has a Maximum Worker Process setting per App Pool. For my AppPool, I increased this value to 16 on our 8 core (16 w/ hyperthreading) Win2008 Xeon server in hopes of getting more parallel processing of client requests for our IIS hosted WCF Service (net.tcp, .net 4.0). I am not sure that this is having the desired affect as I don't see 16 worker processes in task manager despite a heavy load from my multi-threaded test client.

Web gardens was designed for one single reason – Offering applications that are not CPU-bound but execute long running requests the ability to scale and not use up all threads available in the worker process.
The examples might be things like -
Applications that make long running database requests (e.g. high computational database transaction)
Applications that have threads occupied by long-running synchronous and network intensive transactions

Max Worker Process=10
Max Worker Process=no of CPU


4)     Limit the queue length for application pools

When running an IIS server in worker process isolation mode, limit the queue length for application pools to prevent large numbers of requests from queuing and overloading the IIS web server.
Adding a new request to the queue can result in exceeding the maximum queue length. In turn, the IIS server may reject the requests and send a 503 error to the client. Keep the queue length shorter to boost IIS performance.


5)     IIS HTTP compression

Enable HTTP compression on the Microsoft IIS server to use bandwidth more effectively. This results in faster response times between the IIS web server and compression-enabled browsers.
IIS can provide three compression options, including static files only, dynamic application responses, and both static and dynamic application responses.
Enable dynamic compression for the server when bandwidth is an issue as indicated by IIS server monitoring, but remember that compression consumes CPU time and memory resources significantly.
Sites > Compression>

6)      Use the Expires header in IIS7

Configure the HTTP Expires header to improve IIS server performance. Generally, continuous HTTP requests sent from new website visitors to display pages creates a massive load on the IIS server.
Configuring the Expires header allows caching pages (and page elements such as images, scripts, css, etc.) on the client side and helps avoid unnecessary HTTP requests.

In IIS 7, Expires headers can be enabled in the system.webServer section of the web.config file. Using the Expires header, you can determine how long files can be cached on the client side. This may be a certain number of hours or days in the future or a fixed date.
7)     Windows 2008 Network Settings

8)     Change max concurrent requests per CPU setting

Max Concurent Request is calculated by following formula
(MaxWorkerThreads * no Of CPU) – (MinFreeThreads * no Of CPU)
This is 12 by default on a single-proc machine.
So performance does improve by adding more CORE/CPU(hardware) to your system
So If you have Two Processor with below configuration
maxWorkerThreads               100
minFreeThreads                      88
Than MaxConcurent Request would be
(100*2) - (88*2) =24 Concurent Request
If you add two more Core than
Than MaxConcurent Request would be
(100*4) - (88*4) =48 Concurent Request.


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\2.0.50727\MaxConcurrentRequestsPerCPU

Set this to a value higher than 12 (12 is the default)
[DWORD]
Change the maxConcurrentRequestsPerCPU setting from 12 to 5000. This allowed IIS to process more requests concurrently.


Thursday, May 31, 2012

Improve windows networking


Improve windows networking (especially if hosting webservers)


First of all, I forgive you for having to use windows to host your web server :)

Now that thats out of the way, here's how you speed up networking performance on windows (especially if you happen to host Apache, IBM HTTP Server, or any other web server on a windows machine)

Create a .reg file (eg: perf.reg) with the contents that follow:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
"MaxUserPort"=dword:00008000
"TcpTimedWaitDelay"=dword:0000001e
"TcpMaxDataRetransmissions"=dword:00000005

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces]
"TcpAckFrequency"=dword:00000001
"TcpDelAckTicks"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AFD\Parameters]
"EnableDynamicBacklog"=dword:00000001
"MinimumDynamicBacklog"=dword:00000020
"MaximumDynamicBacklog"=dword:00001000
"DynamicBacklogGrowthDelta"=dword:00000010
"KeepAliveInterval"=dword:00000001

Double click on the file to merge its contents into the registry. Restart the machine.
You're done.







1)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
Value Name: MaxUserPort
Value Type: REG_DWORD
Valid Range: 5000-65534 (decimal) Default: 0×1388 (5000 decimal)
New Value: 65534
Description: This parameter controls the maximum port number used when an application requests any available user port from the system. Normally, ephemeral (that is, short-lived) ports are allocated between the values of 1024 and 5000 inclusive.
2)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
Value Name: TcpTimedWaitDelay
Value Type: REG_DWORD
Valid Range: 30-300 (decimal)
Default: 0xF0 (240 decimal)
New Value: 30
Description: This parameter determines the time that must elapse before TCP can release a closed connection and reuse its resources. This interval between closure and release is known as the TIME_WAIT state or 2MSL state. During this time, the connection can be reopened at much less cost to the client and server than establishing a new connection.
Normally, TCP does not release closed connections until the value of this entry expires. However, TCP can release connections before this value expires if it is running out of TCP control blocks (TCBs).
A lower TcpTimedWaitDelay setting means that the sockets wait in the TIME_WAIT state for less time. A higher MaxUserPort setting means that you can have more sockets in the TIME_WAIT state.




Thursday, April 12, 2012

foxrun.pif cannot start or run due to incompatibity with 64 bit version of windows. unsupported 16-bit application

---------------------------
Unsupported 16-Bit Application
---------------------------
The program or feature "\??\c:\program files (x86)\microsoft visual foxpro 7\foxrun.pif" cannot start or run due to incompatibity with 64-bit versions of Windows. Please contact the software vendor to ask if a 64-bit Windows compatible version is available.



Solution:


FOXRUN.PIF is just shortcut to MS-DOS program (COMMAND.COM)

Command.com is not exist in 64 bit machine.

CMD.EXE is working in 64 bit.

So make shortcut of C:\Windows\System32\cmd.exe at D:\LD\ with name of FOXRUN.PIF


Now your application will work fine.


-----alternate solution

16 bit applications do not run under 64 bits. foxrun.pif is not required in 64 bit machines.

\ld\foxrun.pif delete or rename it.


Wednesday, December 7, 2011

win error error 0x80070522


This issue might occur permissions are not set properly for the C Drive.

Make sure that you are logged in as Administrator.

To take ownership of C Drive, follow these steps:

1. Right-click the C Drive and then click Properties.
2. Click the Security tab.
3. Click Advanced, and then click the Owner tab.
4. In the Name list, click your user name, or click Administrator if you are logged in as Administrator, or click the Administrators group.
5. Click on Edit and then put a check mark against "Replace all existing inheritable permissions on all descendants with inheritable permissions from this object".
6. Click OK, and then click Yes when you receive the following message:
This will replace explicitly defined permissions on all descendants of this object with inheritable permissions from C-Drive (C:).
Do you wish to continue?
7. Once the permissions are replaced, click on Ok.

Restart computer

8. Check if you are able to copy, paste or delete any documents now.
If the above steps fail then you may also want to disable UAC and check if that helps.
1. Click Start, type msconfig in the start search box, and then press Enter.
If you are prompted for an administrator password or for a confirmation, type the password, or click Continue.
2. Click the Tools tab.
3. Click Disable UAC and then click Launch.
4. A command window appears, and shortly thereafter, a notification bubble appears informing you that UAC is disabled.
5. Click Ok and restart your computer to apply the change.

Thursday, June 9, 2011

create group users


net localgroup LD_user /add


net user kshitij password /add /fullname:"Kshitij Rakesh" /expires:never /passwordchg:no

net localgroup LD_user kshitij /add

Replace String in text file

c:\> BatchSubstitute.bat "&Yourname" kshitij up78896.sql > up78896_new.sql

==========

@echo off
REM -- Prepare the Command Processor --
SETLOCAL ENABLEEXTENSIONS
SETLOCAL DISABLEDELAYEDEXPANSION

::BatchSubstitude - parses a File line by line and replaces a substring"
::syntax: BatchSubstitude.bat OldStr NewStr File
:: OldStr [in] - string to be replaced
:: NewStr [in] - string to replace with
:: File [in] - file to be parsed
:$changed 20100115
:$source http://www.dostips.com
if "%~1"=="" findstr "^::" "%~f0"&GOTO:EOF
for /f "tokens=1,* delims=]" %%A in ('"type %3|find /n /v """') do (
set "line=%%B"
if defined line (
call set "line=echo.%%line:%~1=%~2%%"
for /f "delims=" %%X in ('"echo."%%line%%""') do %%~X
) ELSE echo.
)


======================

Wednesday, March 23, 2011

Kill DLLhost from task Manager

When memory leaks occur in IIS scripts, you will find DLLHost.exe eating up a lot of memory and ultimately reaching a point where you will need to restart IIS to get the service working again… One way to contain this automatically is to use the Performance Logs and Alerts snapin.

1. Create a batch file that does nothing but run tskill /a dllhost
2. Surf to Control Panel | Administrative Tools | Performance
3. Open up Performance Logs and Alerts
4. Right-click on Alerts and click New Alert Settings. Name it “Auto-kill DLLHost”.
5. Click the “ADD” button, choose the computer, choose Memory and then create an alert for 1GB.

1. In the Action tab, choose Run this Program and set it to run the batch file you created above.

Now, every time memory crosses 1GB usage, the dllhost process is automatically killed.


Friday, August 27, 2010

Delete file from date

forfiles only work in windows 2000 /2003/ vista

Folder Location C:\Test\arch
file older than 5 days
*.* all file extension (*.txt, ......)

----------------

forfiles /p C:\Test\arch /s /m *.* /d -5 /c "cmd /c echo @path"


forfiles /p C:\Test\arch /s /m *.* /d -5 /c "cmd /c del @path"


FORFILES [/P pathname] [/M searchmask] [/S] [/C command] [/D [+ | -] {MM/dd/yyyy | dd}]
----------

/p pathname Indicates the path to start searching. The default folder is the current working directory (.).

/m search mask Searches files according to a searchmask. The default searchmask is '*' .

/s Instructs forfiles to recurse into subdirectories. Like "DIR /S".

/C Indicates the command to execute for each file. Command strings should be wrapped in double quotes.

The default command is "cmd /c echo @file".


The following variables can be used in the command string:
@file - returns the name of the file. @fname - returns the file name without extension.
@ext - returns only the extension of the file.
@path - returns the full path of the file.
@relpath - returns the relative path of the file.
@isdir - returns "TRUE" if a file type is a directory, and "FALSE" for files.
@fsize - returns the size of the file in bytes.
@fdate - returns the last modified date of the file.
@ftime - returns the last modified time of the file.


/D date Selects files with a last modified date greater than or equal to (+), or less than or equal to (-), the specified date using the "MM/dd/yyyy" format; or selects files with a last modified date greater than or equal to (+) the current date plus "dd" days, or less than or equal to (-) the current date minus "dd" days. A valid "dd" number of days can be any number in the range of 0 - 32768. "+" is taken as default sign if not specified.



Examples: FORFILES /?
FORFILES
FORFILES /P C:\WINDOWS /S /M DNS*.*
FORFILES /S /M *.txt /C "cmd /c type @file | more"
FORFILES /P C:\ /S /M *.bat
FORFILES /D -30 /M *.exe /C "cmd /c echo @path 0x09 was changed 30 days ago"
FORFILES /D 01/01/2001 /C "cmd /c echo @fname is new since Jan 1st 2001"
FORFILES /D +8/19/2005 /C "cmd /c echo @fname is new today"
FORFILES /M *.exe /D +1
FORFILES /S /M *.doc /C "cmd /c echo @fsize"
FORFILES /M *.txt /C "cmd /c if @isdir==FALSE notepad.exe @file"

Monday, February 8, 2010

USB drive Disable Enable

Set deny permissions for the user/s and/or group/s to:
%SystemRoot%\Inf\Usbstor.pnf
%SystemRoot%\Inf\Usbstor.inf
It is highly recommended to rename the file names before changing
permissions.

To disable the access to USB port, in windows XP and 2000, follow the steps below
1. Click Start, and then click Run.
2. In the Open box, type regedit, and then click OK.
3. Locate, and then click the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor
4. In the right pane, double-click Start.
5. In the Value data box, type 4, click Hexadecimal (if it is not already selected), and then click OK.
6. Quit Registry Editor.

To re-enable a disabled port, follow these steps below

1. Click Start, and then click Run.
2. In the Open box, type regedit, and then click OK.
3. Locate, and then click the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor
4. In the right pane, double-click Start.
5. In the Value data box, type 3, click Hexadecimal (if it is not already selected), and then click OK.
6. Quit Registry Editor.

Friday, January 22, 2010

how to recover deleted file from network drive

Issue: how to recover deleted file from network drive

Solution:
settings on Server

1. go the properties of Share Network Drive
2. Shadow Copies
3. Setting as per your requirement


settings on Client

To recover a file that was accidentally deleted

1. Locate the folder where the deleted file was stored (on the network), right-click the folder, and click Properties. The Properties dialog box will appear.

2. On the Previous Versions tab, double-click the most recent version of the folder that contains the file that you want to recover. A list of files that are stored in that previous version will appear.

3. Right-click the file that was deleted and clicks Copy and paste.

how to recover deleted file from network drive

Issue: how to recover deleted file from network drive

Solution:
settings on Server

1. go the properties of Share Network Drive
2. Shadow Copies
3. Setting as per your requirement


settings on Client

To recover a file that was accidentally deleted

1. Locate the folder where the deleted file was stored (on the network), right-click the folder, and click Properties. The Properties dialog box will appear.

2. On the Previous Versions tab, double-click the most recent version of the folder that contains the file that you want to recover. A list of files that are stored in that previous version will appear.

3. Right-click the file that was deleted and clicks Copy and paste.

Tuesday, October 6, 2009

Windows terminate process forcefully

Windows terminate process forcefully

taskkill /f /im process-name.exe

/f - Stands for that process be forcefully terminated.

/im - Stands for the image name of the process to be terminated

In order to kill all these process I made a batch file which contains the forcefull termination command for all these programs and then I added the batch file in windows startup.

1. open Notepad and paste the following commands one per each line by line

taskkill /f /im wmpnscfg.exe
taskkill /f /im ctfmon.exe
taskkill /f /im mobsync.exe.exe

Read more: http://www.technixupdate.com/terminate-programs-forcefully-in-windows/#ixzz0QE2O6QIR


2. Save the file as terminate.bat or with any other name but with .bat extension.

3. Now Drag and Drop terminate.bat file in All Programs >> StartUp

4. Now, restart windows all these useless programs which you used to kill manually will be automatically terminated.

Note: You can also place the terminate.bat file on desktop and run it manually and kill all the useless process.

Read more: http://www.technixupdate.com/terminate-programs-forcefully-in-windows/#ixzz0QE2POIGP

Followers