none
Trying to Retrieve Reg Value From Remote Machines

    Pertanyaan

  • I am trying to retrieve a registry value from each computer using a for each loop and then output that value to a folder in a csv.
    That part works fine. The part I am having an issue with is having powershell connect to the remote computers. 

    This is running internal only
    I have admin rights across all workstations
    Firewalls are configured to allow all traffic to pass

    When I run this script I get this error for every workstation it tried to connect to:

    Enter-PSSession : Connecting to remote server workstationX failed with the following error message : WinRM cannot complete the operation. Verify that the 
    specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and 
    allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local 
    subnet. For more information, see the about_Remote_Troubleshooting Help topic.
    At C:\Users\Rich_Ellis\Desktop\O365\O365Channels\O365Channel.ps1:5 char:2
    + {Enter-PSSession -ComputerName $Computer
    +  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (workstationX:String) [Enter-PSSession], PSRemotingTransportException
        + FullyQualifiedErrorId : CreateRemoteRunspaceFailed
    My script is:

    $Computers = Get-Content "C:\Users\Rich_Ellis\Desktop\O365\O365Channels\computers.txt"
    
    foreach ($Computer in $Computers)
    
    {Enter-PSSession -ComputerName $Computer 
    
    $key = 'HKLM:\SOFTWARE\Microsoft\Office\CLickToRun\Configuration'
    (Get-ItemProperty -Path $key -Name CDNBaseUrl).CDNBaseUrl | Export-CSV -path "\\s00itstorage\OfficeChannel\$($env:COMPUTERNAME)-O365Channel03292018.csv"}
    


    Any help would be appreciated. TIA
    Kamis, 29 Maret 2018 14.46

Semua Balasan