SHARE
TWEET

Untitled

a guest Oct 19th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Read-SQLConfigFile {
  2.     <#
  3.     .SYNOPSIS
  4.     Takes configuration file and shows features that are being set
  5.    
  6.     .DESCRIPTION
  7.     Function to show what features and settings are being adjusted by the configuration file.  Allows for comparison of
  8.     config files when combined with Compare-Object
  9.    
  10.     .EXAMPLE
  11.     Read-SQLConfigFile -Path C:\temp\configuration.ini
  12.  
  13.     explore all settings in specified configuration file
  14.  
  15.     .EXAMPLE
  16.     get-childitem -filter *.ini | Read-SQLConfigFile
  17.  
  18.     pass all ini files in current folder to Read-SQLConfigFile
  19.  
  20.     .Example
  21.    
  22.     $reference = get-item DPM_SQL_ConfigurationFile.ini | Read-SQLConfigFile
  23.  
  24.     (get-item SP_SQL_ConfigurationFile.ini | Read-SQLConfigFile) | compare-object -ReferenceObject $reference
  25.  
  26.     compare two configuration files to observe difference
  27.    
  28.     .Notes
  29.     Author - Jonathan Allen
  30.    
  31.     #>
  32.     [cmdletbinding()]
  33.     param(
  34.         [parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)][string]$Path,
  35.         [parameter()][string]$type
  36.     )
  37.     begin { }
  38.     process {
  39.         # get all rows that have = assignment
  40.         $content = select-string -Path $Path -Pattern "=" -AllMatches
  41.         return ($content | Select-Object line )
  42.  
  43.     }
  44.     end { }
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top