locked
Powershell query - Executing an ISPAC file RRS feed

  • Question

  • 

    Hi Guys

    Know some of you are experts in this stuff

    I have

    1) A PS1 script location

    X:\SomeVarDir\SomeVarDir2\TFS_apps209\Recertisure\Development\PResentation\Recertisure.Database\Post-Deployment\PoweShell\Script1.ps1

    2) A project deployment file at:

    X:\SomeVarDir\SomeVarDir2\TFS_apps209\Recertisure\Development\SSIS\SSIS_Recert_Final\bin\Development\DeployProject.ispac

    The problem is everyone has different locations for X:\SomeVarDir\SomeVarDir2 up to the point where the TFS_Apps209 comes from tfs so the folder structure is fixed from there on in

    I need to:

    1) get the path up to the start of TFS_Apps209 segment of the directory and store it nomatter where on the network or what folder its deployed to I just need to get the filepath up to that point

    2) Head down a fixed filepath and execute the ispac file which will do the deployment

    3) The result needs to populate a variable $ProjectFilePath

    Can this be achieved?

    • Edited by James OHara Tuesday, February 12, 2019 12:24 PM update
    Tuesday, February 12, 2019 12:18 PM

All replies

  • Can this be achieved?

    I'm pretty sure it can.  ;-)

    Please read this first: This forum is for scripting questions rather than script requests.

    Also find scripts here: PowerShell Gallery or here: TechNet Gallery - resources for IT professionals.

    Learn PowerShell: Microsoft Virtual Academy - Getting Started with Microsoft PowerShell.

    Script requests: Microsoft Technet Script Center - Requests.

    For your particular task - you could use UNC paths or you have to use relativ paths.


    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''


    Tuesday, February 12, 2019 12:28 PM
  • There is no way to decode what you are asking.  If you have a script then post the part that you are having issues with and any exact and complete errors.


    \_(ツ)_/

    Tuesday, February 12, 2019 12:42 PM
  • 
    ###########SSIS Deploy#################
    
    Import-Module SQLPS –DisableNameChecking
    
    # Load the IntegrationServices Assembly
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Management.IntegrationServices") | Out-Null;
    
    # Variables
    $ProjectFilePath = "C:\TFSWorkspaces\TFS_apps209\Recertisure\Development\SSIS\SSIS_Recert_Final\SSIS_Recert_Final\bin\Development\SSIS_Recert_Final.ispac"
    

    So Instead of ME setting C:\TFSWorkSpaces\ - I need to get that part of it up to the point TFS_apps209 is automatically - assuming the script we are running is also under the same path - which it is

    J

    Tuesday, February 12, 2019 1:28 PM
  • With
    Split-Path -Path $PSScriptRoot -Parent
    you will get the parent folder of the folder where your script is. Of course you could determine the parent folder of this parent folder and the parent folder of that parent parent folder.  ;-)

    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''


    • Edited by BOfH-666 Tuesday, February 12, 2019 1:50 PM
    Tuesday, February 12, 2019 1:49 PM
  • Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,

    Lee


    Just do it.

    Thursday, February 28, 2019 2:34 PM