<#====================================================================

Copyright © 2015, September. Michael Pomfret

Get the SharePoint variables from a text file

====================================================================#>

if ($AppPoolAcc -eq $null){

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser

# PowerShell script to get common Varaible from a file

$Data = “C:\temp\SP_Variables.txt”

$lines = Get-Content $Data | Where {$_.trim() -ne “” -and $_ -notmatch ‘#’}

foreach ($line in $lines) {

$variablename = $line -split ‘=’

if (!$variablename)

{ New-Variable -Name variablename[0] -Value $Global:variablename[1]}

else

{

set-Variable -Name $variablename[0] -Value $variablename[1]

}

}

}else

{

write “variables ok”

}