- 8 Week Game
- Quick Ref
Archive for category Windows
Just a real quick batch script i knocked up which sets the appropriate permissions to the various folders in the root of a fresh umbraco install- just drop this into a batch file, and run it from the root of your umbraco install;
REM 2009.10.22 SY - Set permissions- user/ folders from "Install Umbraco 4 on Windows Vista" guide icacls app_code /grant "Network Service":(OI)(CI)(F) icacls bin /grant "Network Service":(OI)(CI)(F) icacls config /grant "Network Service":(OI)(CI)(F) icacls css /grant "Network Service":(OI)(CI)(F) icacls data /grant "Network Service":(OI)(CI)(F) icacls masterpages /grant "Network Service":(OI)(CI)(F) icacls media /grant "Network Service":(OI)(CI)(F) icacls python /grant "Network Service":(OI)(CI)(F) icacls scripts /grant "Network Service":(OI)(CI)(F) icacls umbraco /grant "Network Service":(OI)(CI)(F) icacls usercontrols /grant "Network Service":(OI)(CI)(F) icacls xslt /grant "Network Service":(OI)(CI)(F) pause
We have a bunch of web services which log details of requests that come in, in folders named using the current date- in the format YYYY-MM-DDD-HH-MM-SS. I wanted to produce a simple cleanup batch file which we could run every month to bin all logs for transactions which happened 3 months ago- using the dos commands which exist on Windows Server 2003.
The dos “del” command allows you to delete using wild cards – so for example “dev 2009-07-*” would erase any files starting with “2009-07-”; However this doesn’t work with folders- so it fell to the rd (remove directory) command- but this doesn’t support wild cards (I’m assuming for safety- to stop you permanently erasing 100′s of folders and their contents accidently- remember there’s no recycle bin when you delete from the command line!).
To get around this I created a simple Batch file which accepted a wildcard as a parameter, then removes all those folders at the current level (it wont check recursivly). Just in case this is of use to anyone else, here’s the code;
REM - performs a remove directory, with wildcard matching - example ; rd-wildcard 2007-* dir %1 /b >loglist.txt setlocal enabledelayedexpansion for /f %%a in (./loglist.txt) do ( rd /s /q %%a ) del /q loglist.txt endlocal
We recently got new machines at work with Vista installed, allowing us to use IIS7, which has the added benefit of being able to run more than one site on the local IIS (unlike our previous IIS6 Win XP boxes)
When installing the various incarnations of visual studio to enable me to support some of our legacy app’s I came across a problem when installing Visual Studio 2003. One of the pre-requisites is front page extensions which are no longer shipped with Windows in Vista- the solution was a version of the extensions made by ready to run software which is actually linked to from the Official IIS Site (the article is named “FrontPage 2002 Server Extensions for IIS 7.0″ incase you have to use the site search, after another of microsoft’s random url switch around’s they’re so fond of) -you can grab the install from here : http://www.rtr.com/fpse/
Once you’ve run the installer, make sure you execute the following from the command line to activate them for your default website otherwise the .net installer still won’t recognise that you have them installed;
owsadm.exe –o install
At work we run Windows XP and recently had a big security review where all the passwords were changed. This complicated things for me as our Source Safe database is held on a central server which I access across the network. When trying to access the share I was prompted for a password, so I entered the new one yet it refused to let me in. It seems this is because even though Windows asks you for a password, it doesn;t actually bother using the value you enter as the credentials are all cached!
A quick google later and it turns out you can force windows to clear this cache from the command line (but it also nocks out your network drives so you will need to re-map these!
net use /d *
It will ask you if you’re sure- just say yes and it will wipe out your mapped drives and any saved credentials – so make sure you note down the list of drives you currently have mapped which it will show you, so you can set them up again!