Hai All,
Recently I stuck in a situation where I want create a website by setting up from IIS to all without taking enough effort, at last I found some useful BAT commands for that, Here I am sharing them.
Install IIS – Internet Information Services
Before Installing the IIS we want to make sure that the Windows Update is Not running,Else it may block the installation.For that we can use the Following, and also we can replace ‘stop’ with ‘start’ to start the update service back on.
net stop WuAuServ
Then WE can use the Following Command to enable ALL the features of the IIS, You can delete any features if you don’t want
START /B /WAIT DISM /Online /Enable-Feature /NoRestart /Quiet /FeatureName:IIS-ApplicationDevelopment /FeatureName:IIS-ASP /FeatureName:IIS-ASPNET /FeatureName:IIS-BasicAuthentication /FeatureName:IIS-CGI /FeatureName:IIS-ClientCertificateMappingAuthentication /FeatureName:IIS-CommonHttpFeatures /FeatureName:IIS-CustomLogging /FeatureName:IIS-DefaultDocument /FeatureName:IIS-DigestAuthentication /FeatureName:IIS-DirectoryBrowsing /FeatureName:IIS-FTPExtensibility /FeatureName:IIS-FTPServer /FeatureName:IIS-FTPSvc /FeatureName:IIS-HealthAndDiagnostics /FeatureName:IIS-HostableWebCore /FeatureName:IIS-HttpCompressionDynamic /FeatureName:IIS-HttpCompressionStatic /FeatureName:IIS-HttpErrors /FeatureName:IIS-HttpLogging /FeatureName:IIS-HttpRedirect /FeatureName:IIS-HttpTracing /FeatureName:IIS-IIS6ManagementCompatibility /FeatureName:IIS-IISCertificateMappingAuthentication /FeatureName:IIS-IPSecurity /FeatureName:IIS-ISAPIExtensions /FeatureName:IIS-ISAPIFilter /FeatureName:IIS-LegacyScripts /FeatureName:IIS-LegacySnapIn /FeatureName:IIS-LoggingLibraries /FeatureName:IIS-ManagementConsole /FeatureName:IIS-ManagementScriptingTools /FeatureName:IIS-ManagementService /FeatureName:IIS-Metabase /FeatureName:IIS-NetFxExtensibility /FeatureName:IIS-ODBCLogging /FeatureName:IIS-Performance /FeatureName:IIS-RequestFiltering /FeatureName:IIS-RequestMonitor /FeatureName:IIS-Security /FeatureName:IIS-ServerSideIncludes /FeatureName:IIS-StaticContent /FeatureName:IIS-URLAuthorization /FeatureName:IIS-WebDAV /FeatureName:IIS-WebServer /FeatureName:IIS-WebServerManagementTools /FeatureName:IIS-WebServerRole /FeatureName:IIS-WindowsAuthentication /FeatureName:IIS-WMICompatibility /FeatureName:WAS-ConfigurationAPI /FeatureName:WAS-NetFxEnvironment /FeatureName:WAS-ProcessModel /FeatureName:WAS-WindowsActivationService
Then it will install the IIS and then we can restart and use the IIS.
Create Registry Entry
To create a registry entry we can use the following and Give the Key and Values Accordingly.Here I am Specifying an Example to Setup an Environment variable “path” this will append my new string along with the Path string which is available
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /f /v "Path" /t REG_EXPAND_SZ /d "myNewString;%Path%
Here /f - is used to forcefully change, /v - is the value name /d - is the data for that value, For more options,you can type “reg add /?” in command line to get the optional parameters
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /f /v "StartUpTest" /t REG_SZ /d "\pathToFile.bat"
The above code will help you to run an application the widows user startup, Here you can give your file path as the data, then it will be executed on startup, you can use any executables like BAT or VBS or MSI or EXE files accordingly.
Create Shortcut of Website on Desktop
The following script will let you create a shortcut of a website URL on your desktop for easy access
echo [InternetShortcut] >"%userprofile%\desktop\myTest.url"
echo URL=http://127.0.0.1/website/Index.aspx >>"%userprofile%\desktop\myTest.url"
echo IconIndex=0 >>"%userprofile%\desktop\myTest.url"
The above code will create a shortcut of the local wesite page and the name of the shortcut on the screen will be ‘myTest’. It is possible to give any other url for the same.
Share a Folder for Everyone
The Following command will help you to share a specific folder for all users
net share ShareName="ShareFolderPath\ShareFolderName" /GRANT:Everyone,FULL
IIS application creation
Here I am mentioning few commands that can be used to IIS for creating a web application
%windir%\system32\inetsrv\appcmd.exe set AppPool DefaultAppPool -processModel.identityType:LocalSystem
the Above statement will set the identity type of Default Application pool to LocalSystem
%windir%\system32\inetsrv\appcmd.exe set AppPool /apppool.name:DefaultAppPool /managedRuntimeVersion:v4.0
The above Statement will Set the Framework version 4.0 as the Default Application pool
%windir%\system32\inetsrv\appcmd.exe add app /site.name:"Default Web Site" /path:"/test" /physicalPath:”/PhysicalPathOfFolder”
The above Statement will create an application user the Default web Site in IIS with The name test and you can specify the physical path for the application
%windir%\system32\inetsrv\appcmd.exe delete app /app.name:"Default Web Site/test"
the above code will delete the application which we just created.
Delete all java with a single command
the following command will delete all the versions of Java installed on your computer with just a single statement
wmic product where "name like 'Java%'" call uninstall /nointeractive
Hope you get few tricky codes from the above, use it and play around,Contact me for any doubt,Will clear if I know,
Thank you.
0 comments:
Post a Comment