Github user nakomis commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/650#discussion_r30902153
  
    --- Diff: 
software/database/src/main/resources/brooklyn/entity/database/mssql/installmssql.ps1
 ---
    @@ -0,0 +1,49 @@
    +[#ftl]
    +#!ps1
    +#
    +# Licensed to the Apache Software Foundation (ASF) under one
    +# or more contributor license agreements.  See the NOTICE file
    +# distributed with this work for additional information
    +# regarding copyright ownership.  The ASF licenses this file
    +# to you under the Apache License, Version 2.0 (the
    +# "License"); you may not use this file except in compliance
    +# with the License.  You may obtain a copy of the License at
    +#
    +#  http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing,
    +# software distributed under the License is distributed on an
    +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +# KIND, either express or implied.  See the License for the
    +# specific language governing permissions and limitations
    +# under the License.
    +#
    +
    +$Url = "${config['mssql.download.url']}"
    +$Path = "C:\sql2008.iso"
    +$Username = "${config['mssql.download.user']}"
    +$Password = '${config['mssql.download.password']}'
    +
    +
    +$WebClient = New-Object System.Net.WebClient
    +$WebClient.Credentials = New-Object 
System.Net.Networkcredential($Username, $Password)
    +$WebClient.DownloadFile( $url, $path )
    +
    +$mountResult = Mount-DiskImage $Path -PassThru
    +$driveLetter = (($mountResult | Get-Volume).DriveLetter) + ":\"
    +
    +New-Item -ItemType Directory -Force -Path "C:\Program Files 
(x86)\Microsoft SQL Server\DReplayClient\ResultDir"
    +New-Item -ItemType Directory -Force -Path "C:\Program Files 
(x86)\Microsoft SQL Server\DReplayClient\WorkingDir"
    +
    +Install-WindowsFeature NET-Framework-Core
    +
    +$pass = '${attribute['windows.password']}'
    +$secpasswd = ConvertTo-SecureString $pass -AsPlainText -Force
    +$mycreds = New-Object System.Management.Automation.PSCredential 
($($env:COMPUTERNAME + "\Administrator"), $secpasswd)
    +
    +Invoke-Command -ComputerName localhost -credential $mycreds -scriptblock {
    +    param($driveLetter)
    +    Start-Process ( $driveLetter + "setup.exe") -ArgumentList 
"/ConfigurationFile=C:\ConfigurationFile.ini" -RedirectStandardOutput 
"C:\sqlout.txt" -RedirectStandardError "C:\sqlerr.txt" -Wait
    --- End diff --
    
    NOTE: The $driveLetter defined on line 33 is unavailable in this 
scriptblock, and so is passed into the scriptblock via the argumentlist on line 
47. The param($driveLetter) directive on line 45 indicates that the zeroth 
argument in the argumentlist on line 47 should be referenced as "$driveLetter" 
within the script block


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to