Put variable into another variable

Hi All~
I am writing the following script:
Add-Type -Path 'C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Smo\11.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Smo.dll'
get-content 'C:\SLDATA\Serverlist.txt'  | foreach-object {
#write-output `n
###write "Server Name: $_"
$SrvConn = new-object Microsoft.SqlServer.Management.Common.ServerConnection
$SrvConn.ServerInstance=$_
#Use Integrated Authentication
$SrvConn.LoginSecure = $true
$SrvConn.ConnectTimeout = 1
$srv = new-object Microsoft.SqlServer.Management.SMO.Server($SrvConn)
$dbs += $srv.Databases
$dbs | select name,onwer,size | Sort-object size
clear-variable -Name dbs
Then the output will be :
Name               Owner              size
master             sa                     1024
master             sa                     2048
tempdb             sa                    5000
tempdb            sa                     6000
if I want to add a output column of the server name like the following
Servername     Name        Owner     Size
Server1            master       sa           1024
Server2            master        sa         2048
Server1             master       sa         5000
Server2            master        sa           6000
how to re-write the script

Try this:
Add-Type -Path 'C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.Smo\11.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Smo.dll'
$Servers = get-content 'C:\SLDATA\Serverlist.txt'
foreach ($server in $servers) {
#write-output `n
###write "Server Name: $_"
$SrvConn = new-object Microsoft.SqlServer.Management.Common.ServerConnection
$SrvConn.ServerInstance=$_
#Use Integrated Authentication
$SrvConn.LoginSecure = $true
$SrvConn.ConnectTimeout = 1
$srv = (new-object Microsoft.SqlServer.Management.SMO.Server($SrvConn)).Databases
$srv | Add-Member -type NoteProperty "Servername" $server
$dbs += $srv
$dbs | select servername,name,owner,size | Sort-object size
clear-variable -Name dbs
Assigning the get-content to a variable allows you to use the foreach ($server in $servers) so the server name is available at the end of the pipeline.  
Assigning the .databases element to $srv instead of the whole object allows you to add the server property.
Hope this helps!  I don't have a SQL instance to test...

Similar Messages

  • I need to get photos off a water damaged iPhone 3GS. Can I take out the component that has the photos (is this the main board?) and put it into another of the same phone to retrieve the photos? Please help

    I need to get photos off a water damaged iPhone 3GS. It spent time underwater, saltwater. I let it dry for a week, turned it on, the apple symbol came on, then it died. I need to retrieve my photos off it. Can I take out the component that has the photos (is this the main board?) and put it into another of the same phone to retrieve the photos? Please help

    You're talking about the logic board. The two most likely things to get toasted, with water damage, are the battery(it shorts out), & the logic board. The worst water damage would be salt water. I'm afraid your logic board is toast.

  • Can I take a selection from one clip and put it into another?

    I'm pretty new to this so thanks. I want to assemble a clip that has parts of three different takes. Splitting the screen works for a couple of the takes..but i'm wondering if I can use the four point matting to isolate a character and put him into another clip...the backgrounds are the same and the set up when shot is the same...but there is no blue or green screen involved so I'm wondering if this is possible in FCP. Hopefully the question makes sense...thanks!

    So you are trying to "cut out" your subject and paste him onto another take? Should be easy enough- just use the four or eight point matte to cut out a square around the subject, then layer that clip on top of the other take you want to superimpose him in. As long as the angle/lighting were the same, it should work. If you find you want a more complicated matte, try Tom's 50 Point Matter, which has a bezier curves option.

  • My photos are pixelated when I put them into another new document such as a photo collage.  I am trying to put a regular 8x11 image into a 4x6 photo collage of two other images.  All come out blurry.

    I need help! I am trying to put several photos that are large size 8x11 into a small 4x6 new document photo collage.  When I do my images are blurred or pixelated.  Even my fonts in the new document are pixelated and my photshop brushes as well.  I am a novice so I may be doing something wrong.  Any help would be greatly appreciated.

    I have the dinosaur PSE2 but the method should be the same in 11.
    Image > Resize > Image Size  (the path to Image Size might be different in 11). This brings up the window:
    The DPI is in the Resolution box. Enter the new value. Check the Constrain Proportions and Resample Image boxes and click OK.

  • Is it possible to get my iTunes money out of one account and put it into another account?

    So I bought a Macbook Pro recently and a lady, who was working at the Apple Store, was putting in a Back to School giftcard for $100 in my account but I forgot the answers to my security questions. Since the lady already have put that money in that account, I was wondering if I make a new account and take the money out of my old account and I can put it my new account. Will it be possible or not? Please answer my question

    janelle27 wrote:
    ... I was wondering if I make a new account and take the money out of my old account and I can put it my new account. Will it be possible or not? Please answer my question
    This is not possible...

  • ListView Control - How Take Data Out of One ListView Control and Put It Into Another ListView Control Please Help

    Public Class Form1
    'Also Let Me Note - I will actually only want to move an item from lvOriginalList if the PersonAge is (lets say) '21
        'I have a ListView named
        ' lvOriginalList
        'It has the Following Columns
        ' IDNumber
        ' PersonName
        ' PersonAge
        'I have a Second ListView named
        ' lvRemovedList
        'It has the Following Columns
        ' IDNumber
        ' PersonName
        ' PersonAge
        'What I am attempting to do is read a row out of the first listview
        'Compare the IDNUmber, PersonName and PersonAge from out of it (lvOriginalList)
        'And If the Information is not present in the second ListView (lvRemoved) then Move it to it
        'And then Remove that Row from the First one (lvOriginalList)
        'What I have tried:
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            'Populate lvOriginalList with Test Data
            Dim FileNum As Integer = FreeFile()
            Dim lvOriginalListCounter As Integer = 0
            FileOpen(FileNum, "d:\testdata\alphadata.txt", OpenMode.Input)
            lvOriginalList.Items.Clear()
            Do While Not EOF(FileNum)
                Dim OriginalIDNumber As String = ""
                Dim OriginalPersonName As String = ""
                Dim OriginalPersonAge As String = ""
                OriginalIDNumber = LineInput(FileNum)
                OriginalPersonName = LineInput(FileNum)
                OriginalPersonAge = LineInput(FileNum) 
                lvOriginalList.Items.Add(OriginalIDNumber, lvOriginalListCounter)
                lvOriginalList.Items(lvOriginalListCounter).SubItems.Add(OriginalPersonName)
                lvOriginalList.Items(lvOriginalListCounter).SubItems.Add(OriginalPersonAge) 
                lvOriginalListCounter = lvOriginalListCounter + 1
            Loop
            FileClose(FileNum)
        End Sub
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Dim OriginalIDNumber As String = ""
            Dim OriginalPersonName As String = ""
            Dim OriginalPersonAge As String = ""
            Dim CompareIDNumber As String = ""
            Dim ComparePersonName As String = ""
            Dim ComparePersonAge As String = ""
            Dim NumlvRemovedListItems As Integer = 0
            Dim CompareCounter As Integer = 0
            For Each item As ListViewItem In Me.lvOriginalList.Items
                '1  -   Get A Row Out of lvOriginalList
                OriginalIDNumber = item.Text
                OriginalPersonName = item.SubItems.Item(1).Text
                OriginalPersonAge = item.SubItems.Item(2).Text
                '2  -   Check To See If That Person Is Already  in lvRemovedList
                'Have to check to see if the lvRemovedList list Box is Empty
                NumlvRemovedListItems = lvRemovedList.Items.Count
                If NumlvRemovedListItems = 0 Then
                    'the lvRemovedList listbox is empty
                    'so add That Person as the first entry into the list box (lvRemovedList)
                    lvRemovedList.Items.Add(OriginalIDNumber, NumlvRemovedListItems)
                    lvRemovedList.Items(NumlvRemovedListItems).SubItems.Add(OriginalPersonName)
                    lvRemovedList.Items(NumlvRemovedListItems).SubItems.Add(OriginalPersonAge)
                    'then remove the player from the lvPlayerList listbox
                    item.Remove()
                Else
                    For Each itemb As ListViewItem In Me.lvRemovedList.Items
                        CompareIDNumber = item.Text
                        ComparePersonName = item.SubItems.Item(1).Text
                        ComparePersonAge = item.SubItems.Item(2).Text
                        If OriginalPersonName = ComparePersonName Then
                            'do nothing that persons name is already in the lvRemovedList list
                        Else
                            'do this because the player is not already in a matchin the lvRemovedList list
                            lvRemovedList.Items.Add(CompareIDNumber, CompareCounter)
                            lvRemovedList.Items(CompareCounter).SubItems.Add(ComparePersonName)
                            lvRemovedList.Items(CompareCounter).SubItems.Add(ComparePersonAge)
                        End If
                    Next
                End If
                CompareCounter = CompareCounter + 1
            Next
        End Sub
    End Class
    'So what Am I doing Wrong
    'It is only Removing the First entry out of lvOriginalList (but at least the remaining data is still there and the empty Row is removed)
    'And only That first Entry is Appearing in lvRemovedList
    'Please Help

    Hello,
    I have created a simple sample, you could focus on the button click event and edit it to fit your requirements by yourself.
    Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    With ListView1
    .View = View.Details
    With .Columns
    .Add("IDNumber")
    .Add("PersonName")
    .Add("PersonAge")
    End With
    With .Items
    For index = 20 To 33
    .Add("ID" & index, index - 19)
    With ListView1.Items(.Count - 1).SubItems
    .Add("Name" & index)
    .Add(index)
    End With
    Next
    End With
    End With
    With ListView2
    .View = View.Details
    With .Columns
    .Add("IDNumber")
    .Add("PersonName")
    .Add("PersonAge")
    End With
    With .Items
    For index = 21 To 22
    .Add("ID" & index, index - 19)
    With ListView2.Items(.Count - 1).SubItems
    .Add("Name" & index)
    .Add(index)
    End With
    Next
    End With
    End With
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    For Each item As ListViewItem In ListView1.Items
    If CInt(item.SubItems(2).Text) < 29 Then
    item.Remove()
    Dim blContain As Boolean = False
    For Each item2 In ListView2.Items
    If item2.Text.ToString().Equals(item.Text.ToString()) Then
    blContain = True
    'Exit For
    End If
    Next
    If Not blContain Then
    ListView2.Items.Add(item)
    End If
    End If
    Next
    End Sub
    End Class
    Result.
    Regards,
    Carl
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • My brother put a sim in phone then he took it out and put it into another phone but the number is still on imessage and i wanna delete the number and i dont wanna put money on the

    hhh

    Deactivate iMessage.
    Leave it as is and change the "Start New Converstations from" option in Settings > Messages.
    Do nothing....
    It really doesn't matter.
    What are you truly trying to accomplish?

  • How do I get the results of 2 text fields and put the output into another ?

    I have 2 text fields that multiply off of each other.
    My question is, is there a way to get the result of this and put it into another text field? And from that result get another result? Or do I have to get the results from a textarea?

    I have 2 text fields that multiply off of each other.I assume this really means you want to have something else multiply the contents of the two text fields. When you are using an object-oriented language, it is helpful if you consider what objects are responsible for what actions. Loose descriptions lead to confusion.
    My question is, is there a way to get the result of
    this and put it into another text field? And from
    that result get another result? Or do I have to get
    the results from a textarea?Assuming that your "text field" is a Swing text component (and not, say, an HTML text field) then it has a getText() method that returns the contents as a String. If you plan to multiply this by something then you'll want to convert it to an int or a double or maybe a BigInteger or a BigDecimal object. Are we on the right track here?

  • Need Your Help with Loading SWF into another Flash Movie!

    Hello,
    I have created TWO Flash movies. They work just fine
    individually, but I get problem when I put one into another one!
    The main Flash is a Menu and the second one if a Photo Album.
    The Menu is series of animation (Moving Objects) which finally
    comes into rest and create the menu. The photo album is another SWF
    file which is called with in the first Flash Movie (The Menu). The
    SWF file is loaded as follow into the Main Flash.
    MovieClip.prototype.drawRect = function(x, y, w, h) {
    this.beginFill(0xFF0000, 100);
    this.moveTo(0, 0);
    this.lineTo(0+w, 0);
    this.lineTo(0+w, 0+h);
    this.lineTo(0, 0+h);
    this.lineTo(0, 0);
    this.endFill();
    this._x = x;
    this._y = y;
    this.createEmptyMovieClip("mc6", 6);
    mc6.lineStyle (3, 0x000000, 100);
    mc6.drawRect(-77, -17, 20, 20);
    mc6._xscale = 100;
    mc6._yscale = 100;
    loadMovie("photoAlbum.swf", mc6);
    Problem arises when I click on the Play Button of the
    photoAlbum.swf (Photo Album) since the execution of the play button
    causes the Flash starts once again from the beginning of the entire
    Flash Movie (Beginning of the animation creating the menu) and it
    simply jumps into the Firm One of my Flash Movie.
    Could you tell me how I can isulate what is in layer 6 (Where
    the photoAlbum is loaded to) from the rest of my Flash Movie?
    I hope I managed to explain my problem. I would like to take
    this opportunity to thank you in advance for your help.
    Cheers,
    Babak

    Hello Anya,
    I have realized the problem arises from the Wait Function
    which causes the Photo Album to pause for a period of time (Two
    Seconds) once a Photo is fully displayed (I have Fade in/out Photo
    Album). I realized everything works OK once I remove the function
    and rather left the Photos to be flipped without any pausing (This
    is an Auto-loading Album which simply Flips the photos!).
    Here is the Wait Function which is causing all the trouble.
    function wait()
    stop();
    var myInterval = setInterval(function ()
    play();
    clearInterval(myInterval);
    }, 2000);
    Thank you so much for your help.
    Cheers,
    Babak

  • How do I take data from a data grid and put it into a variable?

    I am having problems taking data from a datagrid (guess you got that from the title) and setting it to a variable. I am tak
    ing the data from 3 different rss feeds, depending on what button you press, and showing it in a grid. I would like to be able to do more with this data. Here is my code so far:
    <mx:VBox id="vbox" x="70" y="150">
      <mx:Label text="This Data Grid is doing nothing" />
      <mx:DataGrid width="1000" dataProvider="{fullXML}">
       <mx:columns>
        <mx:DataGridColumn id="dataGrid" *dataField="channel.description" headerText="Feed"/>
       </mx:columns>
      </mx:DataGrid>
    </mx:VBox>
    <!-- from test 5 -->
    <mx:Move id="moved" target="{hbox}" repeatCount="0" easingFunction="mx.effects.easing.Linear.easeIn" />
    <mx:HBox id="hbox" fontSize="12" fontFamily="courier">
      <mx:Label text="{website**}" />
    </mx:HBox>
    * this is the data I want to get out
    ** this is where I want to be able to put the variable.
    I don't know if I can do it here or if I need a function or what.
    I would like to be able to put it into an array, but step one is anything at all, so I'm trying just a variable.

    Where do I put that line of code? I see that it goes at the Script part near the top, but how can I use that, I am pretty new to this language. I am not familiar with this line, where does it bind the value from the datagrid to the variable?
    fullXML[myDataGrid.selectedIndex].FIELD_NAME;
    myDataGrid would be the id from the grid I am guessing?
    and selected index would be the channel.description part?
    and FIELD_NAME; is the variable name?
    does this go into a funtion or is it placed at the top where the variables are declared?

  • Putting calculated value into another application

    Hi,
    I have an HCM application with the following simple HRAccount dimension.
    ALL_HR_ACC
         |___SALARY
         |___BONUS
         |___OT
    I want to put the value of ALL_HR_ACC into TstAccount.HRExp, which is in another application called TstFinance. This can be perfectly done by the following code.
    *DESTINATION_APP=TstFinance
    *SKIPDIM=Employee
    *RENAME_DIM HRAccount=TstAccount
    *WHEN HRAccount
       *IS SALARY,BONUS,OT
           *REC(FACTOR=1,HRAccount="HRExp")
    *ENDWHEN
    However, if I change the IS statement to the following, nothing will happen.
       *IS ALL_HR_ACC
    In this simple example, I don't mind putting all 3 HR accounts SALARY,BONUS,OT. However, in many situations, SALARY and other HR accounts are derived from other accounts as well. It could be very cumbersome to put the whole bunch of calculation into the script for just transferring the single value of ALL_HR_ACC into another application.
    Anyone could give me any advice on this? Somebody told me using EVGTS could easily do the trick. However, such functions or formulas will disappear when I expand the worksheet.
    Thank you!
    Sunny

    Sunny,
    The script behavior is correct.  Script logic basically only works with the base memebrs, unless you utilize the statement called Calc Dummy Org.  This statement acts like a variable and aggregates the values into a "parent" type value to be passed on or used in a REC statement.  But, the process you used for the purpose you have is the best, fastest method, even if it is a scope of 50 base accounts from a select statement.
    As for using an input template or excel; if you have an evdre expansion input template, and wish to send the values to a different cube, just add another EVDRE, but remove all the expansions.  Make the page key range fixed or based on the other EVDRE statement.  Use excel to relate to the account to be sent  to the parent account. It should be quite simple to send the total values to a summary cube from the same template that is used for the input process.  However, the logic you wrote accomplished the same effect.
    Hope this helps.

  • Getting error after putting variable in select statement

    Hi All,
    Kindly help me with Pl/sql code
    here i'm trying to put variable in select statement ....
    I successfully put the Yr and Mnth ..but getting error for loop variable "i"
    Here i'm getting error that too because of " i" only-->TRIM(UPPER(TO_CHAR(TO_DATE(i||'-'||Mnth||'-'||Yr,'dd-Mon-YYYY'),'DAY')))
    Please find the full code below.
    Declare
    Yr number not null:=2010;
    Mnth varchar2(20) not null:='Jun';
    v_val number:=0;
    begin
    for i in 1..2 loop
    case i
    SELECT count(*) into v_val
    FROM DUAL
    WHERE TRIM(UPPER(TO_CHAR(TO_DATE(i||'-'||Mnth||'-'||Yr,'dd-Mon-YYYY'),'DAY')))
    in (UPPER('Monday'),UPPER('Tuesday'),UPPER('WEDNESDAY'),UPPER('THURSDAY'),UPPER('friday'))
    end case;
    end loop;
    end;

    Declare
      Yr number not null:=2010;
      Mnth varchar2(20) not null:='Jun';
      v_val number:=0;
    begin
      for i in 1..2 loop
      SELECT count(*) into v_val
      FROM DUAL
      WHERE TRIM(UPPER(TO_CHAR(TO_DATE(i||'-'||Mnth||'-'||Yr,'dd-Mon-YYYY'),'DAY')))
      in (UPPER('Monday'),UPPER('Tuesday'),UPPER('WEDNESDAY'),UPPER('THURSDAY'),UPPER('friday'));
    end loop;
    end;

  • Automator - Putting Variable in Path?

    I am trying to use the automator action Download URLS as the last step in my automator app. Earlier in the script I create a new folder in a specified place (new folders are all created in the same place). The name of the new folder is a text variable movieName. As the last step in the script I want to download the url the action is given but download it to the movieName folder. Just dragging the movieName variable into the download url action doesnt work and usually it just ends up on my desktop. How can I set the path of the download urls action to a text variable in a certain place? I was thinking about just making a text variable with the actual location of the folder but I do not think this would work, but I don't know. Like make a variable that has the text /Volumes/Hard Drive/movieName, I know how to do that but I don't think the download urls action will take that as a valid path. If this is impossible then if it is possible to do it via applescript I would be fine with that too, but would need to know what my script would be. Thanks a lot this is my last problem! Thanks in advance any help is appreciated.

    There are various built-in conversions between some types of data, but there isn't one that can guess a full file path from just a name.  You can manually create a file path by entering and dragging the desired pieces of text into a variable, but the New Folder action returns a path to the newly created folder(s), so you can just put that into a variable and use it in the Download URLs action..

  • TS2530 When I put a burned cd from one Mac into another Mac, song titles do not show up! I have to enter them manually! My CD player reads the titles that i on the cd; how can I get my Mac to do so?

    When I put a burned cd from one Mac into another Mac, song titles do not show up! I have to enter them manually! My CD player reads the titles that i on the cd; how can I get my Mac to do so?

    The problem is that I burned these CD's myself from music that I added from my personal collection to iTunes. The INFO is ON the CD's (it appears perfectly when I put the CD in my Numark mixer...so I know the info is on the CD), but for some reason, my MAC PRO will NOT read the info on the burned CD when I place the CD into the MAC PRO. The CD was burned on a MAC that I no longer own. But there HAS to be a way to transfer songs from a burned CD with the INFO that is on the CD burned with iTunes.
    PLEASE HELP!
    -Old Appel

  • How can you take a photo from one event and put it in another, without dragging to desktop and dragging back into iPhoto and moving it to the event folder I want it in.

    As the title says I need help on how to take a photo from one event and put it in another, without dragging to desktop and dragging back into iPhoto and moving it to the event folder I want it in. Right now when I want to move a picture from one event to another I drag it to my desktop then delete it from iPhoto then I drag it back into iPhoto and put where I want it.An example would be taking a photo from the Christmas event and add it to a specific person event.  Can I do that within the events section without all the dragging. Also is there anyway I can remove duplicates from iPhoto without going through each and every file. Any help would be greatly appreciated.

    Apple doesn't make it easy to do what you want.  However, here's how I do it. 
    Select the photo you want to move and create a new Event for it via the Event ➙ Create Event menu option.
    In the Event mode select the new Event with the one picture and drag it onto the Event you want to move the photo to.

  • I used a usb turntable to import old vinyl records into iTunes. Then with the cloud and iTunes match I put them on another Mac.  The songs come up in the music list but they are greyed out.  How do I get them recognized.

    I used a usb turntable to import old vinyl records into iTunes. Then with the cloud and iTunes match I put them on another Mac.  The songs come up in the music list but they are greyed out.  How do I get them recognized.  The symbol states the songs were downloaded from iCloud.  I would like to get them to play so that I can make a playlist, and burn a CD.

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Unsync all music and resync
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up           
    - Restore to factory settings/new iOS device.

Maybe you are looking for

  • Load failed due to Overflow converting from 853156+16

    Hi All, Load is getting failed from one DSO to another DSO with following error message. and its AP AR load Runtime error while executing rule -> see long text Message no. RSTRAN301 Diagnosis An error occurred while executing a transformation rule: T

  • Jaybird headphones and Macbook Pro Retina bluetooth connectivity issues

    I recently purchased the Jaybird Bluebuds X Premium headphones and for awhile it would connect to my new Macbook Pro Retina 15'' via bluetooth, but now it doesn't anymore. The headphones connect just fine to my phone (iPhone 4S), and other Macbook Pr

  • Execute queue thread count set back?

    I have a script which automatically sets up execute queues (and their thread counts) for either an admin server or two managed servers in a cluster (depending on whether it's a standalone deployment). Upon building a domain, the script connects to a

  • Non-domain user authentication against SSAS on Active/Passive Cluster

    Hello, We have an Active/Passive SQL Server setup (DB1 & DB2 Servers) connected to a cluster for SQL & SSAS.  I have a web server not on the same domain that I am trying to authenticate with SSAS.  This works OK if I set the website to impersonate my

  • Mapping of KNA1-BRAN1-5 to CRM

    Hello, in ERP you have the Industry Codes 1 - 5 which have each their own field in the table KNA1. So if you enter s.th. in the Industry Code 2 (w/o entering data in Industry Code 1)it is saved in the field KNA1-BRAN2 and it will stay in this field.