When new developers start or if we get a new machine here, there are some manual setup steps required. Trivial stuff but that can make for a good case for me to sample PowerShell.
# PowerShell 1.0 script
# 2009-09-10 bfellows
#
# This script is designed to facilitate the setup of new developer machines
# It creates two new machine level variables for CVS and SSIS and
# ensures the path to the CVS executable is in the system path
#
# Create variables and assign default values
$cvsPath = "C:\Program Files\CVSNT\"
$cvsRoot = "hostname=cvs.domain.com:/usr/cvs"
$ssisConfig = "Provider=SQLNCLI.1;Data Source=localhost;Integrated Security=SSPI;Initial Catalog=SYSDEVDB"
$pathDelimiter = ";"
# Snag the existing path into a dictionary
$path = Get-ChildItem Env:path
# Set the environment variables which you couldn't have guessed from the
# method call
[Environment]::SetEnvironmentVariable("SSIS_CONFIG", $ssisConfig, "Machine")
[Environment]::SetEnvironmentVariable("cvsroot", $cvsRoot, "Machine")
# If CVSNT isn't in the path (this assumes it has been installed)
if (! $path.Value.Contains($cvs))
{
# Append the cvs path, prefaced with a path delimiter
[Environment]::SetEnvironmentVariable($path.Name, $path.Value + $pathDelimiter + $cvsPath, "Machine")
}
No comments:
Post a Comment