Run commands on remote Hyper-V host in different domain/network with powershell

Hi experts,
My Setup: Windows Server 2012 R2 / SCVMM 2012 managing localhost and other Hyper-V hosts
I need to run a script on the remote Hyper-V Host which is in different domain/workgroup using powershell.
I have tried
Invoke-SCScriptcommand cmdlet. But I am getting the below error
Error (2917)
Virtual Machine Manager cannot process the request because an error occurred while authenticating MY-PC-15.mydomain.local. Possible causes are:
1) The specified user name or password are not valid.
2) The Service Principal Name (SPN) for the remote computer name and port does not exist.
3) The client and remote computers are in different domains and there is not a two-way full trust between the two domains.
The network path was not found (0x80070035)
I tried the 'Run Script Command' option in the Host tab in VMM. But getting the same error.
Checked that it uses the 'Invoke-ScScriptcommand' PS cmdlet.
Could someone explain how to run scripts on remote Hyper-V host in different Domain/Perimeter network ?
Regards,
Saleem

Hi Saleem,
Please try to follow the article below to regarding using command "enter-pssession" across domains :
https://social.technet.microsoft.com/Forums/windowsserver/en-US/f60a29ef-925e-4712-9788-1f95e12c8cfc/forum-faq-introduce-windows-powershell-remoting?forum=winserverpowershell
(I tested it in my lab )
Best Regards,
Elton Ji
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] .

Similar Messages

  • How to configure PerformancePoint to access SSAS hosted in different domain.

    I have Sharepoint 2013 installed in a demo environment with a domain say ABC. I have username and password of an account say DEC\sqlread, having only read permission in SSAS (2008 R2) production environment, which is hosted on different domain. How do I
    configure Performance point to use that read account (DEC\sqlread) of SSAS  whenever any user of ABC domain uses performance point reports.
    I don't have much permission in SSAS production environment to configure things, but I have admin access to demo environment.

    Hi  Dev,
    According to your description, you want to configure  PerformancePoint  to connect SSAS using a read account.
    You can configure the Unattended Service Account for  the PerformancePoint Services:
    Here is a good  blog you can refer to:
    http://www.c-sharpcorner.com/UploadFile/a9d961/create-an-analysis-service-data-source-connection-using-shar/
    Reference:
    http://technet.microsoft.com/en-us/library/jj819321(v=office.15).aspx
    Thanks,
    Eric
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
    contact [email protected]
    Eric Tao
    TechNet Community Support

  • Hosting 2 different domains

    we host our own exchange 2013 server internally with a couple hundred mailboxes for 'companyA.com'.
    we are going to have a new startup company with only a handful of mailboxes/users (offsite) but they will be using
    [email protected]
    what is the best way to host 2 different domains on our existing hardware/licenses? 
    is there a way to avoid having all of my existing users SMTP address appended with this second domain?  (if i remember correctly, when you add a new domain to the accepted domain list, all existing users get 1 SMTP address entry added to their list.
    Thanks, Tony McPherson

    if I add this new domain to the accepted domain list, my default policy says 'all recipient types'. but I don't see a way to distinguish
    between companyA and companyB.
    all of my existing users except maybe 1 or 2 are selected to 'automatically update via policy'.  so it seems to me that if I add the new domain name to the accepted domain list, they'd all get one new entry.  from the policy options page, I don't
    see any selections that I could use to distinguish between the two companies.
    *Specify the types of recipients this email address policy will apply to.
    -All recipient types
    or
    -Only the following recipient types:
    with options:
    +Users with Exchange mailboxes
    +Mail users with external email addresses
    +Resource mailboxes
    +Mail contacts with external email addresses
    +Mail-enabled groups
    Thanks, Tony McPherson

  • SSH SUDO passwordless to run commands on remote server

    Hi Experts,
    We are running various OS/Network and Database related commands and scripts on Local and Remote Server to perform/compare the results
    As part of this activity, we have bottleneck on running commands/scripts on the remote server as we need to provide password everytime whenever we use SSH command
    Also, we need to run command as ssh sudo su - oracle for security purpose which prompts password two times.
    we would like to automate this process in order to save password securely(temporarily) while running ssh sudo commands/scripts.
    I see, there are various solutions using SSHPASS,EXPECT commands, however we dont have anything available to use within our group.
    We may not be able to use SSHPASS as this component not installed during VM build, so we left with only option to use EXPECT.
    So, Need your help to get any example working script using EXPECT for ssh sudo passwordless connection.
    Appreciate if anybody can share ideas or working scripts
    Thanks in advance

    FWIW, here is a small script that I wrote several years ago that may help you to automate the password less ssh setup with a remote system. I just verified it and changed it to create a RSA key. The script still works and runs fine under Oracle Linux and Mac OS X.
    Simply create a script called "passwordless-ssh" with the content shown below.
    Assign execute privileges: chmod u+x passwordless-ssh
    Then run the script as following:
    ./passwordless-ssh user@target_hostname_or_ip
    The script will create a ssh RSA private and public key, prompt for the remote host password and the copy the pubic key to the remote host. A subsequent ssh login to the remote host should no longer prompt for the password. It is essential however that the scrips runs in an interactive session, which is verified.
    #!/bin/bash
    # Creating SSH public RSA key if non exist and copying it to remote target
    # for passwordless SSH login.
    # Author: Catch 22, Oracle OTN, 28-APR-2015
    # Arguments: $1 (ssh login to remote target)
    ME=passwordless-ssh
    LOGFILE="/tmp/$ME.log"
    f-mode()
    # Check if session is interactive (terminal) or non-interactive (UDEV).
    # Output: 0 = interactive, 1 = non-interactive
       [[ -t 0 || -p /dev/stdin ]] && return 0 || return 1
    f-log()
    # Display messages in interactive mode, or write output to syslog
    # (/var/log/messages) when in non-interactive mode. Write the messages
    # to a logfile if the syslog logger interface command is not available.
    # Input: $1 = text
       if f-mode; then
          echo "$ME: $1"
       elif hash logger; then
          logger "$ME: $1"
       else
          echo "$ME:`date`: [logger] Cannot execute, aborting" >> $LOGFILE
          echo "$ME:`date`: $1" >> $LOGFILE
       fi     
    # Exit and show error if current session is not interactive.
    [ ! f-mode ] && f-log "[session] non-interactive, aborting" && exit 1
    keyfile="$HOME/.ssh/id_rsa"
    [ -z "$1" ] && echo "Missing 'user@target_host' argument. Aborted." && exit 1
    if [ ! -f $keyfile ]; then
       mkdir -p $HOME/.ssh
       ssh-keygen -t rsa -f $keyfile -N ''
    fi
    keycode=`cat $keyfile.pub`
    remote_cmd2="echo "$keycode" >> $remote_ssh_file; chmod 644 $remote_ssh_file;"
    remote_ssh_dir="~/.ssh"
    remote_ssh_file="$remote_ssh_dir/authorized_keys"
    ssh -q $1 "mkdir -p $remote_ssh_dir; chmod 700 $remote_ssh_dir
    echo "$keycode" >> $remote_ssh_file; chmod 644 $remote_ssh_file"
    unset ME LOGFILE keyfile keycode remote_ssh_dir remote_ssh_file
    #END

  • Cannot ad Hyper-v host from unstruted domain

    Did anyone face a problem like me? When I try to add a untrusted Hyper-V host in to SCVMM 2012 on VMM console, console suddenly disconnect to server. After I reopen up the console, find out process failed at step installing agent.
    with error message like this:
    1700
    The Virtual Machine Manager service on the %ServerName; server stopped while this job was running. This may have been caused by a system restart.
    To restart this job, navigate to the Jobs view and select the job in the results pane. Then, in the Actions pane, click Restart.
    Command Line Interface: Restart the job by running the following command:\n\nPS> Restart-Job -Job (Get-VMMServer %ServerName; | Get-Job | where { $_.ID -eq "%TaskID;"})
    tTry to run this job again and problem still there. gonna be crazy with this!

    Might be better to post this in the SCVMM forum.  Here is one that deals with clustering -
    http://social.technet.microsoft.com/Forums/en-US/home?forum=virtualmachinemgrclustering&filter=alltypes&sort=lastpostdesc
    .:|:.:|:. tim

  • Can Hyper-V host join a domain of a virtual machine domain controller on that same host?

    Learning about Failover Clustering with Hyper-V. I have two hyper-v nodes(servers). I want to add them to a failover cluster, but it said that the nodes must be in a domain to join failover cluster.
    Can I create a domain controller role on a virtual machine hosted on that same node and join that node to the domain?
    Can I just create a role on one of the two nodes along with hyper-v role and join the second node to the domain?

    You can create
    an AD VM and join the Hyper-V host to it in Server 2012 (or Hyper-V Server 2012, the preferred OS for running a Hyper-V Cluster). This did
    not work in any previous version of Windows.
    This would be a really horrible idea for a production environment, but suitable for a lab/training.
    Also, you only need one host/node to form a cluster (though it probably throws errors/warnings if you do)

  • Copying files from local computer to a remote server which is not in Domain and with username and password?

    "I have one workstation with static IP, Wants to create batch file to log in to this,using user name and password, copy back up files from that workstation to my desktop with batch file, please help
    I am currently using batch file for back up for domain servers with robocopy commands in batch file  but one of the workstation is not in domain and has static ip , also it has username and password,
    Wants to create batch file on my desktop to log in this server---with username and password,, copy files from particular folder and paste it on my desktop in particular folder or auto create that folder,
    please help, "
    P Dave

    JRV,
    I can understand that, 1stly I am not a scripting guy, I know very very basic of this,
    2ndly, I need help , I am not asking anyone here to write code for me, I have already wrote that but its not doing which its suppose to do,
    check below screen shot, after running suggested script, it has mapped drive ,
    now I do not want to do that, I want just files to copy from that machine to my machine, and want script which I can run from any PC,
    Tried with UNC PATH as well, but not making any difference, its keep mapping that server drive to my computer
    P Dave
    JRV,
    I can understand that, 1stly I am not a scripting guy, I know very very basic of this,
    2ndly, I need help , I am not asking anyone here to write code for me, I have already wrote that but its not doing which its suppose to do,
    check below screen shot, after running suggested script, it has mapped drive ,
    now I do not want to do that, I want just files to copy from that machine to my machine, and want script which I can run from any PC,
    Tried with UNC PATH as well, but not making any difference, its keep mapping that server drive to my computer
    P Dave
    Bill - he still sees that "connection" although it isn't mapped it is attached temporarily.
    P - Log off and log back on and the attached connection will be gone.  It is temporary.   Again - knowing the basics of WIndows would let you know this.
    We have given you all of the answers that are possible.  There is no other way unless you have installed things like PowerShell and PowerShell remoting or an FTP server.
    If you do use a drive it can be just as easily deleted after you have finished the copy.
    Again: "NET USE /?" will tell you all of the options.
    Saying you know nothing is not an excuse for not thinking or looking more deeply into the suggestions made by those trying to help you.  This is not a MIcrosoft support forum or help desk.  It is a forum for admiinistrative scripting and assumes
    that those coming here are technically trained or experienced in the basics of Windows technology.
    ¯\_(ツ)_/¯

  • How to get low performances alert for Hyper-v Host ON scom

    Hello Expert,
    We have to implement a scenario VM Live migration which involved (SCOM,SCVMM,SCORCH Parts).
    where SCOM parts  will monitor the performances of SCVMM 's Hyper-V hosts and VMs running the within the Hyper-v hosts.
    when the VMs utilization exceed the threshold and then scom monitor checks the performances of Running Hyper-v Hosts ,then using SCORCH automation ,VMs are moved to one of the best performances the Hyper-v hosts.
    To implement this ,I have integrated SCOM 2012 R2 AND SCVMM 2012 R2 AND enabled the PRO Tips.
    but don't know how to get alerts and configured related to performances of VMs and Hyper-v host.
    What will be next  needed to achieved this from SCOM PARTS.
    Thanks and Regards
    RICHA KM 

    Hi,
    In addition, hope the management pack for Hyper-v 2012 can be helpful for you, please download and import it to your management group:
    http://www.microsoft.com/en-us/download/details.aspx?id=36438
    Regards,
    Yan Li
    Regards, Yan Li

  • Event Logs of VMs Migration in Failover Cluster of Hyper-V Hosts

    Hello All,
    We're running Failover Cluster of Hyper-V hosts of Windows Server 2012 R2. Using SCVMM 2012 R2 with UR5 for management.
    If any host gets down unexpectedly (due to any reason power/bugcheck/hardware failure or what so ever), then the VMs on that host, of course, get migrated (either quick or live) to some other host within the cluster.
    I want to have logs/events of this VMs migration. I want to know that which of the VMs were residing on that host at that time of failure. Of course, we can't have this info in the Cluster events is Failover Cluster Manager. I am unable to find this info
    anywhere. I have searched in Event Viewer --> Administrative Roles --> Hyper-V. I have searched a lot in the SCVMM, but no success.
    Please help me in finding the exact location of these logs/events. I would also like to know that if the VM was quick migrated or live migrated, and to which host the VM got migrated.
    I'd be highly grateful.
    Thanks in anticipation.
    Regards,
    Hasan Bin Hasib

    This post was cross-posted in the clustering forum.  As noted in that forum, a failure of a host does not initiate a quick or live migration.  Migration requires both the source and destination nodes be operational during the entire migration
    process.  Should a host fail, it is impossible for that host to participate in a migration.  In the case of a host failure, the VM is restarted on another node of the cluster.  You can still use the information provided by Elton for viewing
    events in the event log.  If you want to see the exact sequence of log entries, perform quick/live migrations in a lab and notices the changes in the event log.  You can also fail a host and see the sequence of log entries.
    . : | : . : | : . tim

  • How to backup Hyper-V host server on DPM 2012 R2

    Hi,
    I'm about to backup my first Hyper-V host server using DPM 2012.  I'm looking for a strategy to back up both the host server and virtual machines.  Note:  I'm not really interested in backing up all the virtual machines.  Many are non-production
    or for testing.  How do you do it?  I was thinking about selecting in the protection group:
    - BMR and SS for the Hyper-V host
    - The C: volume of the Hyper-V host
    - Select the Child partition snapshots of the virtual machines I want to backup.
    In my environment, Hyper-V role is installed on the C: drive, but the virtual machines are stored on E:, which I would not backup directly (volumes) since I'm backing up the VMs using Child partition snapshot.
    Would I be able to restore my Hyper-V host and the selected VMs with a backup like this?
    Anyone want to share how they setup their protection groups for Hyper-V?
    Thanks.

    No, use full server backup (image) if VM config are stored at default storage (disk  C).
    Understanding where your virtual machine files are [Hyper-V]
    Using this method to perform a full server backup is the recommended method because it captures more data than the other method.
    Backing Up Hyper-V Virtual Machines
    http://social.technet.microsoft.com/Forums/en-US/4592bad3-9f5d-4313-b9a0-9da6de7f43c2/restoring-vm-settings?forum=winserverhyperv
    Have a nice day !!!

  • 2012 R2 Hyper-V HOST with virtualized 2008 R2 SP1 RDSH - Remote FX Capable?

    This article goes over RemoteFX and RDSH for 2008 R2 SP1, but nothing is discussed in regards to 2012 R2 Hyper-V HOSTs for the virtualized RDSH server.
    http://blogs.msdn.com/b/rds/archive/2011/03/25/q-amp-a-microsoft-remotefx-and-remote-desktop-session-host-servers.aspx
    My goal is to use a 2012 R2 Hyper-V HOST server to provide RemoteFX vGPU performance to a 2008 R2 SP1 RDSH server. Is this possible? If not, are there any solutions that can provide graphics performance benefits to an RDSH server? If so, are there limitations?
    What are the benefits?

    Hi,
    A Server 2008 R2 VM does not support vGPU (neither does 2012/2012 R2).  One possibility if the apps you want to improve are DirectX-based is to run RDSH on a physical server, with a GPU installed,
    and enable the Use hardware default graphics adapter for all Remote Desktop Services sessions group policy setting.
    Please thoroughly test with the intended applications, GPU, and expected concurrent number of sessions to see if this configuration benefits you.  It only potentially benefits DirectX applications, and only applies to full desktop connections,
    not RemoteApps.
    Additionally you may want to test Windows Server Technical Preview/Windows Technical Preview since it has enhanced vGPU capabilities for the VMs.  vGPU is supported for a single-user Windows Server RDSH VM.  Please see the document below (and
    its comments) for more information:
    RemoteFX vGPU Updates in Windows Server Next
    http://blogs.msdn.com/b/rds/archive/2014/11/05/remotefx-vgpu-updates-in-windows-server-next.aspx
    Thanks.
    -TP

  • Running elevated scripts from SCVMM on a Hyper-V host

    SCVMM 2012 R2 conveniently lets me run scripts on hosts using the Run Script Command.
    When not using a runas account, the scripts are run on the host using the Local System account which seems to be unable to run elevated commands. In particular, I want to run the Get-VM Hyper-V cmdlet on the host, and this cmdlet does not work (or rather,
    returns an empty list) from a non-elevated Powershell.
    I don't want to disable UAC because I don't want want to weaken overall security on the host just for this particular scenario.
    Is it possible to use SCVMM's Run Script Command to run elevated commands on the host? Alternatively, can I get Get-VM to return the list of VMs even when run non-elevated?
    (In case it's interesting, I want to run Get-VM on the host rather than Get-SCVirtualMachine on SCVMM because I'm interested in the IDs of the SCSI controllers of the VM, and it seems that SCVMM and Hyper-V each return different IDs. If there's a way to
    get the Hyper-V-visible ID from SCVMM cmdlets then I won't need to run any script on the host at all).

    Hi
    May add this to your script:
    function Set-Elevation
       # Create a new process object that starts PowerShell
       $newProcess = New-Object System.Diagnostics.ProcessStartInfo "powershell";
       # Indicate that the process should be elevated
       $newProcess.Verb = "runas";
       # Start the new process
       [System.Diagnostics.Process]::Start($newProcess) | Out-Null
    Hope this helps. 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.

  • Running commands on VMs remotely

    Hi Everyone
    New to all of this so please bear with me!
    Starting a new project and looking to compare between the use of Hyper V and ESXi.  
    The project is to grab vms regardless of state, turn them on and execute scripts stored on a vm drive. The script execution has to be performed / issued by a user. C# is the main underlying code but we can potentially put in references to use powershell
    scripts / whatever else if we can achieve this using hyper v.
    I know from doing a bit of reading on ESXi that we can do this using a number of ways - vmrun to start, stop and run commands on the actual vm itself. using other vmware libraries and APIs.
    I have read that powershell commands include starting vms, taking snapshots, shutting down vms but I was wondering if we can get into the actual VM remotely / somehow in-order to, for example, run a script which is stored on that VMs C drive.
    Has anyone tried this / is it do-able? -  I have had no luck finding any examples of what we need. 
    Kind Regards,
    Ashley

    I have a few things that I have done historically.
    Really, you have two options.  a WMI (API) call or a WinRM / PowerShell remoting call.
    The difference between the two is 1) security settings and 2) ease of use.
    For WinRM the security needs to be more open then WMI.  But, it is far easier to script as you simply open a remote session and you keep scripting along in the remote shell (the tricky part is pulling values back to the local session).  With WMI
    you always get the values back since you never spawn into another session.
    Below is a WinRM example of using WinRM and returning some value back:
    It executes a WMI command on the remote machine to fin the file I am looking for (as that is faster) and then I read the file with the script.
    # This block of script executes remotely and returns the content of hte CtxSta.config file.>
    $sta = invoke-command -Session $s -ScriptBlock {
    $staArray = get-wmiobject CIM_DataFile -filter 'Extension="config" and FileName="CtxSta"'
    # If IIS Integration is installed there could be multiples, this is the one that CSG is hard coded to use.
    foreach ($e in $staArray) {
    if ($e.Path -match "citrix\\system32") {
    $sta = $e
    get-content -path ([string]$sta.Name)
    # We have returned to local execution.
    foreach ($e in $sta) {
    switch -wildcard ($e) {
    "UID*" {
    $e = $e -replace "UID", ""
    $e = $e -replace "=", ""
    $e = $e -replace " ", ""
    $staId = $e
    $staId
    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.

  • Running commands on a remote UNIX machine

    I am very new to Java. Just wanted to get that out of the way. :)
    I have installed Websphere Application Developer and Websphere Application Server on my Windows 2000 PC and intend to use this machine to host some things I will create.
    One of the main things my tool will do is to maintain/check the status of a few AIX (IBM's UNIX) machines. The way I will do that is to run commands on these remote machines and examine their output.
    For example, someone would click a button on a servlet and it would then rsh to the machine and run "ps -ef" or whatnot and post the output back to the user.
    Usually I could do this from another UNIX machine using rsh or telnetting to it, however, my machine is windows 2000.
    Is there anyway I could do this?
    Any help would be much appreciated.
    Mike

    try looking into the apache jakarta commons library
    for telnet and other useful classes.
    http://jakarta.apache.org/commons/net/apidocs/index.ht
    Oh, I like this answer better - can I change mine? If you can do it from "inside" Java like this, all sorts of ugliness involving where things get installed on various machines and versions of Windows just go away.
    Grant

  • How do I run a unix command to quit ARD if it is running on a remote server I am trying to access?

    how do I run a unix command to quit ARD if it is running on a remote server I am trying to access?

    killall "Remote Desktop"
    Regards.

Maybe you are looking for

  • My icon on my desk (macbook) disappeared, how can I get it back on there?

    It just disappeared and I would like in on my launchpad. it has been there for a long time but it just recently disappeared. I went to applications and tried to drag it, no luck. I even right click on it to see if it'll say add to launchpad...nope...

  • FIX DATE in Payment terms

    HI All, we have a requirement where the due date should be a fix date, say 31st march 2007, irrespective of invoice date. Please let me know if this can be configured & how?

  • Call Javascript Function in my JAVA Applet

    Hello every body, I would like to be able to call a javascript function in my Java applet. I know to call JAVA function with a javascript function but not inverse. Someone can help me please ?

  • Adobe acrobat reader install unsuccessful?

    I am uninstall a version of acrobat reader, and now I cannot install any version. Why is this? Same thing with Safari. Thanks!

  • Insert from a form ! Important Question !

    I have a form based on a block based on a table with 4 fileds if insert the first one , got his value from a tirgger on it's table (ie.like a sequance or something) now , when use the form to insert i just insert a 3 value for the others colums , so