Invoke-Command to pull data from remote user profiles

Welcome Forums General PowerShell Q&A Invoke-Command to pull data from remote user profiles

Viewing 3 reply threads
  • Author
    Posts
    • #195968
      Participant
      Topics: 2
      Replies: 5
      Points: 37
      Rank: Member

      Hi,

      Trying to pull a list of VPN connections(shortcuts) on all of our domain endpoints. Considering the fact that VPN Connections are user based records, and we do not have each users credentials, what method would be an efficient way to pull this data?

      Already tried:

      1- Invoke-command -computername “XX” {get-vpnconnection}

      2-Invoke-command -comutername “XX” {get-vpnconnection -all}

      and the user that is running the above commands is domain-admin.

       

       

    • #196163
      Participant
      Topics: 13
      Replies: 1753
      Points: 3,136
      Helping Hand
      Rank: Community Hero

      What exactly are you looking for? Get-VPNConnection is part of the module VPNClient for Windows 10 VPN Connection Profiles. This is enumerating connection profiles, not shortcuts. If you run Get-VPNConnection from a logged in user, do you see the information you are looking for? Try running it as Admin? Per the documentation, Get-VpnConnection -AllUserConnection is supposed to retrieve information from all profiles.

    • #196322
      Participant
      Topics: 2
      Replies: 5
      Points: 37
      Rank: Member

      Running both commands locally shows desired results, however, if we use invoke-command from a remote system to get the VPN-connections, neither of the commands show the results.

      So, let’s say we run get-vpnconnection on a PC, we see the VPN connections for the currently logged in user.

      and if we run get-vpnconnection -all, then we see VPN connections on all profiles if the user has local-admin rights.

      however, if we run Invoke-command -comutername “XX” {get-vpnconnection -all} from a remote PC, using domain-admin account, we get no results. hosts are domain joined and domain-admin has full rights to the remote machines.

       

       

       

       

    • #196664
      Participant
      Topics: 13
      Replies: 1753
      Points: 3,136
      Helping Hand
      Rank: Community Hero

      Shooting in the dark as I don’t have anywhere to test this scenario, but that should work. You can try to use Get-VPNConnection which accepts a CimSession to make the remote connection:

      https://docs.microsoft.com/en-us/powershell/module/cimcmdlets/new-cimsession?view=powershell-6

Viewing 3 reply threads
  • The topic ‘Invoke-Command to pull data from remote user profiles’ is closed to new replies.