Invoke-Command returning wrong result

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 5 years, 10 months ago.

  • Author
    Posts
  • #5752

    by jmp8600 at 2013-04-02 17:40:09

    Hello There,

    if i run below command on server name testserver which has iis installed

    Get-ItemProperty 'IIS:\AppPools\test' -name processModel.IdentityType

    i get below output
    ApplicationPoolIdentity

    But if i run below command from a different server as shown below, i get different output...$Session variable is storing session to same server. in both cases i imported WebAdministration module which is not shown in the command. what i am doing wrong?

    Invoke-command -command {(Get-ItemProperty 'IIS:\AppPools\test' -name processModel.IdentityType)}-session $Session

    Output:

    PSPath : WebAdministration::\\testserver\AppPools\test
    PSParentPath : WebAdministration::\\testserver\AppPools
    PSChildName : test
    PSDrive : IIS
    PSProvider : WebAdministration
    PSComputerName : testserver
    RunspaceId : 2ff305d8-12c2-40f2-a2c7-b336e4df5754
    PSShowComputerName : True
    Length : 23

    by jmp8600 at 2013-04-02 18:09:17

    issue resolved....thanks.

    i had to use below command to fix it

    Invoke-command -command {param($temp4) (Get-ItemProperty 'IIS:\AppPools\test' -name processModel)}-session $Session -ArgumentList $temp4|select -expand identityTypePS

You must be logged in to reply to this topic.