remote powershell and sql error

PowerShell script exchange

Re: remote powershell and sql error

Veeam Logoby ThomasMc » Mon Jan 30, 2012 4:07 pm

I can't test most of this as it seems to not be supported in 2003 but might be worth a go

Code: Select all
# Run elevated on the computer that will be remoting into Veeam Server
Enable-WSManCredSSP Client –DelegateComputer veeam01

# Run on the Veeam Server and SQL box
Enable-WSManCredSSP Server

# Back to the client your be connecting to veeam on again
$s = New-PSSession veeam01 -Authentication CredSSP -Credential domain\UserYourRunningAs

Invoke-Command -Session $s -ScriptBlock {
   Add-PSSnapin VeeamPSSnapIn
   Get-VBRJob
}


Windows Remote Management (WinRM) supports the delegation of user credentials across multiple remote computers. The multi-hop support functionality can now use Credential Security Service Provider (CredSSP) for authentication. CredSSP enables an application to delegate the user’s credentials from the client computer to the target server.
CredSSP authentication is intended for environments where Kerberos delegation cannot be used. Support for CredSSP was added to allow a user to connect to a remote server and have the ability to access a second-hop machine, such as a file share.
For more information about CredSSP, see KB 951608.
Note WinRM clients and servers will support CredSSP authentication only with explicit credentials.
Windows XP, Windows Server 2003, and earlier: CredSSP is not supported.
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: remote powershell and sql error

Veeam Logoby Tulror » Wed Feb 01, 2012 9:57 am

Hi Thomas,

Good news!

I have tested your commands and its working.

I overlooked the command "Enable-WSManCredSSP Server" which I had run only on the veeam server.
After I ran this command I get the supposed output from the Get-VBRJob.

Now I can extend my script with other command.

Thanks alot for your help!
Tulror
Novice
 
Posts: 9
Liked: never
Joined: Wed Aug 03, 2011 1:25 pm

Re: remote powershell and sql error

Veeam Logoby ThomasMc » Wed Feb 01, 2012 10:22 am

Excellent news :)
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

PS Remoting with Veeam database on a separate DB server

Veeam Logoby pizzim13 » Tue May 01, 2012 8:39 pm

[merged]

I am seeing an issue when using powershell remoting on a veeam 6 server that has its database on a separate sql 2008r2 database server.

Code: Select all
PS H:\> New-PSSession -ComputerName "veeam" -Credential (Get-Credential) | Enter-PSSession

[veeam]: PS C:\Windows\system32> Get-VBRJob

WARNING: You should update your PowerShell to PowerShell 2.0 version.
Get-VBRJob : SQL server is not available
    + CategoryInfo          : InvalidOperation: (Veeam.Backup.Po...mmand.GetVBRJob:GetVBRJob) [Get-VBRJob], CAppExcept
   ion
    + FullyQualifiedErrorId : Backup,Veeam.Backup.PowerShell.Command.GetVBRJob
I can run Get-VBRJob locally on the Veeam server and it returns the correct results. I can run Get-VBRJob locally on a different Veeam server with a local sql db and it returns the correct results. Has anyone else seen this type of behavior?

Case [ID#5188473]
pizzim13
Enthusiast
 
Posts: 86
Liked: 6 times
Joined: Thu Apr 21, 2011 7:37 pm

Re: PS Remoting with Veeam database on a separate DB server

Veeam Logoby Sethbartlett » Tue May 01, 2012 9:44 pm

Check out this thread
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me ;)
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
Sethbartlett
Expert
 
Posts: 282
Liked: 25 times
Joined: Wed Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett

Re: remote powershell and sql error

Veeam Logoby Gostev » Tue May 01, 2012 9:47 pm

Also, did you mention what the warning says? Wasn't PowerShell remoting only added in v2?
Gostev
Veeam Software
 
Posts: 21396
Liked: 2350 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: remote powershell and sql error

Veeam Logoby ThomasMc » Tue May 01, 2012 11:14 pm

I think the Veeamshell checks the PsVersion from the Get-Host(or its .net counterpart) which oddly enough will say its version one on a remote session.

Code: Select all
[coor01]: PS C:\> (Get-Host).Version

Major  Minor  Build  Revision
-----  -----  -----  --------
1      0      0      0

[coor01]: PS C:\> $PSVersionTable.PsVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
2      0      -1     -1


so wouldn't worry about that warning
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: remote powershell and sql error

Veeam Logoby pizzim13 » Wed May 02, 2012 9:49 am

Thanks Seth/Thomas. That worked as advertised.
pizzim13
Enthusiast
 
Posts: 86
Liked: 6 times
Joined: Thu Apr 21, 2011 7:37 pm

Previous

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 9 guests