Geeks With Blogs

News My Blog has been moved to

Michael Freidgeim's Blog My Blog has been moved to Batch files/PowerShell Batch files & PowerShell scripts
Powershell ISE missing features
I've recently did some work with PowerShell ISE and missed a few features,that I wish to have in the ISE.1.It will be good to Stop debugger(Shift-F5) icon on toolbar2.In the popup----------------------... PowerShell ISE------------------------... cannot edit any script files in Windows PowerShell ISE while the debugger is running. To edit a script, stop the debugger.------------------... ---------------------------it will be good to add button to stop debugger.When stopped at ......

Posted On Saturday, February 6, 2016 10:08 AM

Batch file that required administrative privileges.
I wanted to call from batch file powershell script that required administrative privileges.I needed to check, if it was started as Administrator and also set current directory where the batch is located.Thanks to couple of stackoverflow questions I've got this batch@echo offpushd %~dp0 &:: @ check_Permissions:processpo... &:: TODO the script to call@pausegoto end:check_Permissions @rem ......

Posted On Wednesday, January 27, 2016 9:04 PM

PowerShell function to delete if exist and create empty folder
In our PowerShell scripts for different folder it's required to delete if exist and create empty folder. To avoid to repeat folder name in three commands I've created a functionfunction DeleteIfExistsAndCreateEmpt... ){ if ( Test-Path $dir ) { Remove-Item -Recurse -Force $dir } New-Item -ItemType Directory -Force -Path $dir}I've also used this function in answer for SuperUser question How can I copy a directory, overwriting its contents if it exists using Powershell ......

Posted On Wednesday, January 27, 2016 7:58 PM

Using CTT to modify config files for different environments
We previously tried to use msbuild to adjust configuration files for different environments. Recently I found C onfig Transformation Tool(CTT) on CodePlex and with addition of global replace using powershell it is enough and easier to do all required modifications Content of ChangeConfig.cmd: ctt s:..\web.config t:WebConfig.CTT d:..\web.config powershell.exe -command "Get-Content ..\Remoting.config | ForEach-Object { $_ -replace '//localhost/ServicesCI/', '//ServerName01/ServicesCI/' } | Set-Content ......

Posted On Sunday, December 4, 2011 10:47 PM

Batch file to Delete Old Virtual Directories.
On some servers we have many old Virtual Directories created for previous versions of our application. IIS user interface allows to delete only one in a time. Fortunately we can use IIS scripts as described in How to manage Web sites and Web virtual directories by using command-line scripts in IIS 6.0 I've created batch file DeleteOldVDirs.cmd rem rem syntax: iisvdir /delete WebSite [/Virtual Path]Name [/s Computer [/u [Domain\]User /p Password]] REM list all ......

Posted On Saturday, May 8, 2010 8:45 PM

Copyright © Michael Freidgeim | Powered by: | Join free