Remote power-shell connectivity

got below error when trying to connect to remote SharePoint server through power shell.
Steps:
Enable-WSManCredSSP -Role client -DelegateComputer servername.domain.com
winrm quickconfig
Enable-WSManCredSSP -Role server
$farm = Get-Credential
$s = New-PSSession -ComputerName servername.domain.com -Authentication CredSSP -Credential $farm
Invoke-Command -Session $s -ScriptBlock { add-pssnapin Microsoft.SharePoint.PowerShell -ea 0 }
Invoke-Command -Session $s -ScriptBlock { get-spfarm }
Invoke-Command -Session $s -ScriptBlock { get-spcontentdatabase }
Get-PSSession | Remove-PSSessioncmd
Error:
The WinRM client cannot process the request. The authentication mechanism requested by the 
client is not supported by the server or unencrypted traffic is disabled in the service configuration. Verify the 
unencrypted traffic setting in the service configuration or specify one of the authentication mechanisms supported 
by the server.  To use Kerberos, specify the computer name as the remote destination. Also verify that the client 
computer and the destination computer are joined to a domain. To use Basic, specify the computer name as the remote 
destination, specify Basic authentication and provide user name and password. Possible authentication mechanisms 
reported by server:     Negotiate Kerberos For more information, see the about_Remote_Troubleshooting Help topic.
At D:\RAASSP\targetserverCheck.ps1:2 char:6
+ $s = New-PSSession -ComputerName hsv-vplusapp.virtusa.com -Authentication CredSS ...
sudesh withanage

Hi this is how I got it working:
For the Server:
On the domain controller open "Active Directory Users and Computers". Under "Computers" find the servername and right click properties, on Delegation Tab select "Trust this computer for delegation any service (Kerberos Only)"
And then from powershell:
$domainAdminCred = Get-Credential
 Start-Job -ScriptBlock {
        Enable-PSRemoting -Force 
  Enable-WSManCredSSP -Role Server -Force 
    } -Credential $domainAdminCred -Argumentlist servername.domain.com | Wait-Job | Receive-Job
Enable-WSManCredSSP -Role Client -Delegate servername.domain.com -Force
Connect-WSMan servername.domain.com
Set-Item "WSMan:\$server*\Service\Auth\CredSSP" -Value $true
$farm = Get-Credential
$session = New-PSSession -ComputerName servername.domain.com -Authentication CredSSP -Credential $farm
Invoke-Command -Session $session -ArgumentList $path -ScriptBlock {   
        if (-not(Get-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue))
            Add-PSSnapin Microsoft.SharePoint.Powershell
        Get-SPFarm
Hope it helps

Similar Messages

  • Access denied error while running opening remote power-shell session from one azure machine to another

    We are trying to open a remote power-shell session from one azure machine to another azure machine and that is failing with the following error. Any ideas?
    Observations: -
    If the worker role is running under network service or local system, then it fails.
    We emulated the same behavior from a stand-alone exe and that also failed when the exe was run under network service or local system.
    If we run the same stand-alone exe from a user account, then it works.
    Unhandled Exception: System.Management.Automation.Remoting.PSRemotingTransportException: Connecting to remote server sampleapprm.cloudapp.net failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting
    Help topic.
       at System.Management.Automation.Runspaces.AsyncResult.EndInvoke()
       at System.Management.Automation.Runspaces.Internal.RunspacePoolInternal.EndOp
    en(IAsyncResult asyncResult)
       at System.Management.Automation.Runspaces.Internal.RemoteRunspacePoolInternal
    .Open()
       at System.Management.Automation.RemoteRunspace.Open()
       at ConsoleApplication2.Program.Main(String[] args)

    Hi,
    This error only show access is denied, and it is hard for me to deal with this issue, may be Windows Powershell forum or Windows Azure VM are good forums for you, could you give more details information to us for a better help if this issue
    was related with windows Azure.
    Best Regards
    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.

  • OcsPowerShell Access is denied through Remote Power Shell Session

    Hi,
    I have a Quest Message Stats Reporting Server which connects to the OcsPowerShell Internal Web site on the Lync FE enterprise pool.
    I use the below command:
    $cred = Get-Credential
    I use the credential in the format <domain name>\<username>
    $ses = New-PSSession -ConnectionUri "https://pool01.hawaiian.aero/OcsPowerShell" -Credential $cred
    I get the error message " Connecting to remote server failed with the following error message : Access is denied."
    But if I try credential without giving the domain name. It gets connected. 
    The issue here is that per Quest support it should be able to connect using credential provided in the format <domain name>\<username>. This is a Lync web services authentication issue. They recommended to enable Basic Authentication in
    OcsPowerShell site, we did that even after this no luck.
    Need help in troubleshooting this issue.

    Hi,
    I use the credential in the format wiht domain name and without domain name all work for me.
    The Authentication for OcsPowershell, the Anonymous Authentication and Windows Authentication should be enabled. And the providers of the windows Authentication is:
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Run Remote Power shell Script as Administrator

    HI All,
    Is there a way to run a powershell script on a remote computer with run as Admin Mode.
    I am establishing a remote session and executing a ps script which in-turn runs other scripts etc .. its that i need to run this ps with elevated admin privileges.. below is my script .. please suggest options to make it run as admin... 
    #Create credential object
                    $SecurePassWord = ConvertTo-SecureString -AsPlainText $Password -Force
                    $Cred = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $Username, $SecurePassWord
                #Create session object with this
                    $Session = New-PSSession -ComputerName $_ -credential $Cred
                #Invoke-Command
              $Script_Block = "D:\DeployScripts\$env:msp\Deployment.ps1"           
    $Script = $executioncontext.invokecommand.NewScriptBlock($Script_Block)                       
    $Job = Invoke-Command -Session $Session -Scriptblock $Script -run 
      #Close Session
                    Remove-PSSession -Session $Session
    -Dheer

    My guess is that the answer may be no; and below is why I think this:
    When you interactively run as administrator using a non-administrative account, UAC prompts for admin credentials. When you interactively run as administrator using an administrative account, UAC asks if this is OK. If already running as administrator, running
    something else as admin allows you to bypass these prompts.
    In summary, you cannot run as admin without either dealing with the prompts or disabling UAC.
    When you are running remotely, by default you are not running as administrator, therefore you cannot run something as admin without dealing with the prompts. But running remotely usually involved running non-interactively, in which case prompted input is
    not applicable.
    If remote running as admin were allowed, it seems that this could not be done without reducing the security posture of your system.
    This is like Runas.exe itself. It could have been written to allow the password to be passed as a parameter or by reading from stdin. Instead, it forces the password to be entered interactively.
    Al Dunbar -- remember to 'mark or propose as answer' or 'vote as helpful' as appropriate.

  • Remote managment Exchange 2013 SP1 from C# code using Power-Shell.

    Hello,
    Sorry if I am describing something wrong, but it is first time I am using Microsoft development forum.
    I am trying to built library that will manage Exchange remotely using  C# code (VS 2012) and Power-Shell ver.4.0. My workstation and the actual Exchange server physically placed in different domains. In order to test functionalities I am using
    user that is member of all administrating and management groups in the appropriative domain. Remote Power-Shell is enabled on Exchange.
    In order to connect to the Service I am using that part of code :
    internal static bool RedirectionUrlValidationCallback(string redirectionUrl)
    bool result = false;
    var redirectionUri = new Uri(redirectionUrl);
    if (redirectionUri.Scheme.Equals("https"))
    result = true;
    return result;
    internal static ExchangeService ConnectToService(ExchangeVersion version,
    string userName,
    string emailAddress,
    string password,
    string domainName,
    ref Uri autodiscoverUrl)
    ExchangeService service;
    try
    service = new ExchangeService(version);
    service.Credentials = new WebCredentials(userName, password, domainName);
    if (autodiscoverUrl.IsNull())
    var ads = new AutodiscoverService();
    // Enable tracing.
    ads.TraceEnabled = true;
    // Set the credentials.
    ads.Credentials = service.Credentials;
    // Prevent the AutodiscoverService from looking in the local Active Directory
    // for the Exchange Web Services Services SCP.
    ads.EnableScpLookup = false;
    // Specify a redirection URL validation
    //callback that returns true for valid URLs.
    ads.RedirectionUrlValidationCallback = RedirectionUrlValidationCallback;
    // Get the Exchange Web Services URL for the user’s mailbox.
    var response = ads.GetUserSettings(emailAddress, UserSettingName.InternalEwsUrl);
    // Extract the Exchange Web Services URL from the response.
    autodiscoverUrl = new Uri(response.Settings[UserSettingName.InternalEwsUrl].ToString());
    // Update Service Url
    service.Url = autodiscoverUrl;
    else
    service.Url = autodiscoverUrl;
    catch (FormatException fe) // The user principal name(email) is in a bad format. UPN format is needed.
    LoggingFactory.LogException(fe);
    return null;
    catch (AutodiscoverLocalException ale)
    LoggingFactory.LogException(ale);
    return null;
    catch (Exception e)
    LoggingFactory.LogException(e);
    return null;
    return service;
    Then I am trying to reach existing mailbox of that user, using this part of code :
    try
    var runSpace = getRunspace();
    var pwShell = PowerShell.Create();
    pwShell.Runspace = runSpace;
    var command = new PSCommand();
    command.AddCommand("Get-Mailbox");
    command.AddParameter("Identity", userPrincipalName);
    command.AddParameter("RecipientTypeDetails", recipientType);
    pwShell.Commands = command;
    var result = pwShell.Invoke();
    if (result.IsNotNull() && result.Any())
    // TODO : fill appropriative DTO and return it.
    else
    // TODO : send back appropriative error.
    closeRunSpace(runSpace);
    catch (Exception e)
    // TODO : log the exception and send back appropriative error.
    private Runspace getRunspace()
    var runSpaceConfig = RunspaceConfiguration.Create();
    var runSpace = RunspaceFactory.CreateRunspace(runSpaceConfig);
    PSSnapInException snapEx;
    var psInfo = runSpaceConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.E2010", out snapEx);
    runSpace.Open();
    return runSpace;
    private void closeRunSpace(Runspace runSpace)
    runSpace.Close();
    runSpace.Dispose();
    With this part I had problem. I received exception that appropriative Snap-in is not installed on my computer. I had no installation disk of Exchange in order to install Management Tool (as I understand this is the way to add needed part) so I changed run
    space activation to that part of code :
    private Runspace getRunspace()
    var newCredentials = (PSCredential)null;
    var connectionInfo = new WSManConnectionInfo(new Uri("http://exchange.domainname.local/powershell?serializationLevel=Full"),
    "http://schemas.microsoft.com/powershell/Microsoft.Exchange",
    newCredentials);
    connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Kerberos;
    var runSpace = RunspaceFactory.CreateRunspace(connectionInfo);
    runSpace.Open();
    return runSpace;
    Now I am receiving exception :
    "Connecting to remote server exchange.domainname.local failed with the following error message :
    [ClientAccessServer=exchange,BackEndServer=exchange.domainname.local,RequestId=....,TimeStamp=...]
    Access is denied. For more information, see the about_Remote_Troubleshooting Help topic."
    Please help me to understand what I am doing wrong.
    Thank you.
    Alexander.

    In Exchange 2010 you should be using Remote Powershell not local powershell and the snap-in.  Here is a sample that may help you:
    http://blogs.msdn.com/b/dvespa/archive/2009/10/22/how-to-call-exchange-2010-cmdlet-s-using-remote-powershell-in-code.aspx

  • Power Shell Script for Check Remote machinces are live or not

    I have required a Power Shell Script for Check multiple Remote machines are live or not.Please guide me

    This will do it.
    http://gallery.technet.microsoft.com/Ping-IP-Adress-Range-d90ce82d
    &#175;\_(ツ)_/&#175;

  • Any good Power Shell command or script to see connected users in real time for Lync 2013

    Are there any good Power Shell commands or scripts that can tell you how many users are connected to a pool in real time so you can evaluate the current load. I have 3 FE servers in a single pool. We just started deploying the lync client to the users and
    were curious as to how many are actually connected. I saw a number of home made scripts but really didn't care for any of them. I just want to find out how many users that are actually connected to the pool at a particular moment so we can see how many users
    are really using the product.

    Have you looked at Pat Richard's get-csconnections script?: http://www.ehloworld.com/269
    Please mark posts as answers/helpful if it answers your question.
    Blog
    Lync Validator - Used to assist in the validation and documentation of Lync Server 2013.

  • Exchange 2013 CU5 , Exchange Power Shell very very very slow reasponse when using get command.

    Exchange 2013 CU5 , Exchange Power Shell very very very slow reasponse when using get command.
    First my organize has Exchange on 2 site like
    site A (internet facing) : 2CAS 2 MB all are Services pack1
    site B (DR Site , no user active on this site) : 2CAS 2MB all are Services pack 1
    so today I upgrade Exchange 2013 from SP1 to CU5 start on "site B" and I found this issue and the details is....
    When I open EMS on any CU5 for query something (like get-mailboxdatabasecopystatus) the response return very slow and some query will not return at all (like get-owavirtualdirectory).
    But If I using EMS on SP1. Everything is ok then I try to use EMS on SP1 connect to CU5 and try to query something. the result is
    some query command cannot return for any result that are server on siteB (just some query command)
    Problem
    EMS on CU5 return very slow result.
    EMS on SP1 still ok.
    Does anyone face this problem before for CU5??? Please help me figure this out. Thank you
    reply from Social.technet

    Hi,
    Have you used the above cmdlets to check your Exchange server health?
    "all other command that I ran on EMS didn't logged on event viewer.", my environment is the same with you. I use Exchange 2013, only errors will be displayed in MSExchange Management. Actually, it is not related to slow EMS response.
    Hope it helps.
    Best regards,
    Amy Wang
    TechNet Community Support

  • Power Shell vs AutoIT

    How does Power Shell compare to AutoIT in terms of:
    1. functionality
    2. complexity
    3. learning curve
    Currently my interest is for non-GUI functionality, especially for disk/folder/file management, PC maintenance, registry work, date/time, string maniputation, file I/O, interfacing with MS Office, interaction with external programs such as robocopy,
    access to and work on networked PCs and storage.

    As someone who has used both, I can safely say that they hardly compare to one another. AutoIt has its place if you need to automate mouse clicks, keyboard presses, moving windows, locking the keyboard while something is happening on screen, and taking screen
    captures at precise locations.
    I am aware it can do more, but I do not believe it is ever going to provide you the integration that PowerShell can with your computer and the remote computers in which you manage. If you had to choose between the two to put on a resume, you should be choosing
    Windows PowerShell! If you're interests are where you say they are then PowerShell is where you need to be, and so for functionality - it wins.
    As far as complexity and learning curve, I'm going to say it wins again. There is something quite frustrating when trying to do things with AutoIt. You have a single help file to work from that doesn't have much in the way of examples. Beyond that, it just
    doesn't have the community that PowerShell has and so getting answers online can be difficult. Good luck!

  • How to run 'Get-AssignedAccess' or 'Set-AssignedAccess' power shell commands in c# Application

    Hi,
    I have console application using which i am trying to run power shell command  like 'Get-AssignedAccess' or 'Set-AssignedAccess'.
    i am using below code for this it is throwing exception 'Get-AssignedAccess' doesn't exist in cmdlet which is correct because these commands belongs to function category.
    using (PowerShell pwInstance = PowerShell.Create())
                            pwInstance .AddScript("Get-AssignedAccess");
                            var result = pwInstance .Invoke();
    How can we execute this kind of command using c#?
    Thanks,

    Hi prakashlight,
    Thank you for comming back and tell us the result. For more information about how to run PowerShell script in C# language, you can refer to this blogpost here:
    Executing PowerShell scripts from C#
    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.

  • Ipad mini remote app will connect to my itunes library and apple tv but won't display content from itunes library on the apple tv section of remote app

    What I am trying to do is very simple, and I am sure I have done it before.
    I have an Apple TV (2nd Gen) connected to Wifi Network (Airport Extreme 802.11n) I want to stream content from the itunes library on my macbook pro over the wifi network to the Apple TV. This works no problem, home sharing is set up and I can see the itunes library under 'Computer' on the Apple TV interface. I can use the Apple Remote to scroll through and play content from my itunes. Works no problem.
    Now I want to use the remote app on my ipad mini to control the apple tv. Using up to date app (Version 3.01) Again, everything looks like it should work. I have turned on Home Sharing on the remote app settings. It works fine and both my itunes library and Apple TV show up on the interface. I can touch the itunes icon and control the itunes on my computer and play music and video on my computer screen.
    Now when I touch the apple tv icon I can't see my itunes library content to play on the apple tv. I see the below image. If I tap on the icon in the bottom left it takes me back to the screen in the first image. What is the strangest thing is that I can control the apple tv using the gestures interface! This isn't what I want though and I want to be able to see the itunes library on the screen of the ipad and play it on the apple tv. You can see in the video on this link (http://www.youtube.com/watch?v=UvEpgcE9KCs). This is what I am trying to do and I just don't understand why I don't get the screen seen at 1:25 in the video. Instead I get the screen seen in the below image. Any ideas? I know that the remote app is connecting to the apple TV because I can control it using gestures, just strange I can't see the content on the ipad like in the attached video clip, instead I see the screen in the image below. Any ideas would be greatly appreciated!

    OK, Problem solved. Software on Apple TV was VERY outdated. It had been sitting in the box for over a year and needed an update. Problem solved!

  • Add or delete the summary links web part's[deployed as a VS solution] link using power shell

    hi,
     i am having a visual studio custom solution having page layouts implemented. In that solution i am having 1  summary links web part and in that i have hard coded few links and this is  deployed on ion dev and staging env.
    Now, the issue is : yesterday, customer came to me and asking me to change the links from http://abc to
    http://xyz/ in this summary links. can anyone pls throw some light,such that i can change this link using a power shell script. i know  if i go the VS solution and change the link and redeploy [ update-spsolution
    command] will work.
    but if the links are changing regularly , chnaging the vs solution and redeploying is not a good practice.
    if i elaborate li'l bit,  i am adding the screen shot : i need to get the summary link column's value and  need to update[ delete xisting one and  add new ones ]
    is there any way , i can change the links using power shell script?
    i tried the belwo power shells cript to get the page in the page layouts :
    $web = get-spweb
    "http://siteurl"
    $pubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
    $pagesListName = $pubWeb.PagesListName
    $defaultAspxFile = $pubWeb.GetPublishingPage("$pagesListName/mycustomhome.aspx")
    $summaryLinkFieldValue = New-Object
    Microsoft.SharePoint.Publishing.Fields.SummaryLinkFieldValue
    // here am getting the NULL VALUE
    can i get the  summary links field correctly and  delete / modify the same?
    help is appreciated!
    ##$groupLink = New-Object
    Microsoft.SharePoint.Publishing.SummaryLink("My group")
    #$groupLink.IsGroupHeader = $true $summaryLinkFieldValue.SummaryLinks.Add($groupLink)

    Hi Shabeaut,
    Could you tell us why do you want to add a link web part to the master page for all pages?
    I tested that Summary Links web part (and other types of web parts) added in the master page under Quick Launch couldn't be edited when I edit the pages inherited from v4.master page, it looks by design.
    Have you tried using the Quick Launch to add the link instead if you want to show links in all pages.
    Thanks
    Daniel Yang
    TechNet Community Support

  • If your remote will not connect, read this, it will most likely help you.

    If your remote is not connecting, I can almost guarantee it is because you need to forward the ports on your router necessary to control it. I've suggested it to MANY people, and it has helped 100% of them. You need to forward ports TCP 3689 and UDP 5353.
    If you don't know how to do this go to the website www.portforward.com, and click "Guides". Then, under Port Forwarding", click "Port Forwarding Guides by Router".
    It doesn't matter if you're using a PC (which I am), or a Mac (which many of you are), this is more than likely what you need to do.
    And for those of you who have had no problem whatsoever: I'd make sure your security is enabled. If it's not, yer in for a world of hurt if someone finds that out.
    Please reply if this helped you, or if you need some more information. I will check back at 9:00PM Central when I get off work.
    Message was edited by: dylanfowles

    This is the exact same problem i am experiencing, wired pc, into router that also provides the wireless connection for my iphone. I get no device popping up in itunes when trying to add a library in remote.
    I have added the port forwards to my router with no joy, disabled any and all software firewall/av, no joy.
    Its quite frustrating as i can get to my laptop's library just fine (laptop is wireless), i've even tried at work and can get over wireless via an access point onto the network and my pc there is wired in.
    I can only guess it is my router doing something stupid, or because it is running as a gateway and router, or something.
    Any other info would be great

  • Can I use Apple Remote desktop to connect over the internet?

    I would like to use Apple Remote Desktop to connect back to my MacPro desktop at home while I am on my Macbook Air at work.  Will I need a static IP from my service provider to do it.

    Hi
    It's not absolutely necessary but it would be more useful if you did have one. Most ISPs will require you to have a business class broadband service at your home rather than a residential one. These cost more (a lot more in some cases) than a residential service. Call your home location's ISP and discuss it with them.
    If the cost is too much then you could go for a DynDNS account which is free. The details of this account would be configured in the whatever you're using as a firewall at your home's location. This assumes the firewall has the facility to add such an account. Thereafter it's just a question of configuring the port fowarding feature of that firewall.
    A potentially 'big' problem though is whether or not your workplace will allow that kind of traffic out of their network. This would be something you'd need to discuss with them first.
    HTH?
    Tony

  • TS1741 I can't get my remote app to connect my iPad to my Apple TV

    I can't get my remote app to connect my iPad to the Apple TV

    Meanwhile, since Apple does not read these forums, I suggest we all leave comments on their feedback page: http://www.apple.com/feedback/appletv.html
    That way they'll at least know a bunch of us are having this issue.
    Hopefully Apple will issue a fix soon.

Maybe you are looking for

  • Problems saving to pdf files with adobe acrobat on imac

    I have just installed and activated Adobe Acrobat 9.0 on my new iMac OS X 10.8.2, but it keeps coming up with an error message when trying to save a powerpoint presentation to a pdf file. I have downloaded all updates, painfully, one by one, from 9.1

  • How did he do it ?

    I've previously - with no success so far - asked THE BIG FORUM for routines on compression schemes maintaining good quality _and_ reasonable filesize. Please have a look at this videosnippet wich is my goal http://www.tacx-video.com/Downloads/Kem-Iep

  • Adobe Reader stop working in Window vista

    I want to ask how to solve the adobe reader that has stop working in Window vista it happen every two days, The adobe reader that is currently install is Adobe Reader 10, Need help Many thanks

  • I just bought this use mac book pro, and automatically when i try to go on the apple store to upgrade, its an other ID

    its always the apple ID of the owner who had the macbook before. All the info of the owner before has been remove. I check in the preference systeme under user and groupe and theres nothing. i put my apple ID and also my password..... help help ty

  • Shared line appearance service scenario

    I have two 962 phones with version 6.1.3(a) for SLA test. Each has number 3000 and 5000. configuration summary below:                               3000                           5000 EXT1                      3000                           5000 Phon