set repository credentials

PowerShell script exchange

set repository credentials

Veeam Logoby AlexL » Mon Apr 16, 2012 2:37 pm

Maybe I've overlooked something but how would I set credentials for existing repositories?
Regards,
Alex
AlexL
Enthusiast
 
Posts: 52
Liked: never
Joined: Tue Aug 24, 2010 8:55 am
Full Name: Alex

Re: set repository credentials

Veeam Logoby ThomasMc » Mon Apr 16, 2012 2:57 pm

off the top of my head you would use Get-VBRServer to pull the one hosting the repo and there is a method in there to set it(.setcred() or something to that effect (Use "Get-VBRServer - Name "RepoServer" | gm" to get a list), I'm just powering up the lab and will provide a more detailed post soon :)
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: set repository credentials

Veeam Logoby ThomasMc » Mon Apr 16, 2012 3:42 pm

Forget to ask, what type of repo is it? (Win/Linux/CIFS)
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: set repository credentials

Veeam Logoby AlexL » Mon Apr 16, 2012 4:15 pm

cifs
AlexL
Enthusiast
 
Posts: 52
Liked: never
Joined: Tue Aug 24, 2010 8:55 am
Full Name: Alex

Re: set repository credentials

Veeam Logoby ThomasMc » Mon Apr 16, 2012 5:12 pm

If it was any other one I would have had the answer a while ago lol

Code: Select all
$repo = Get-VBRBackupRepository -Name CIFS
$creds = New-Object -TypeName Veeam.Backup.Common.CCredentials -ArgumentList "testdomain\User","Password",0,1
$credentials = New-Object -Type Veeam.Backup.Model.CDbCredentialsInfo -ArgumentList $repo.ShareCredsId, $creds
$manager = [Veeam.Backup.DBManager.CDBManager]::Instance
$manager.Credentials.UpdateCredentials($credentials)
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: set repository credentials

Veeam Logoby AlexL » Mon Apr 16, 2012 6:35 pm

Hi Thomas,

Your code works BUT only for changing existing credentials, in my case I do not have credentials in place yet. So the checkbox also needs to be set.

Thank you very much for your quick replies and efforts so far.

Regards,
Alex
AlexL
Enthusiast
 
Posts: 52
Liked: never
Joined: Tue Aug 24, 2010 8:55 am
Full Name: Alex

Re: set repository credentials

Veeam Logoby ThomasMc » Mon Apr 16, 2012 8:15 pm

Hi Alex, I can't seem to find how to do it, what's funny is I can't get credentials enabled at all when using Powershell with CIFS, the other types get there creds from the stored hosts(why I suggested Get-VBRServer in my first post) but CIFS seems to have me scratching my head as to how your suppose to enable it, as the Add-VBRBackupRepository seems more geared towards the Win/Linux ones and doesn't take a input for what we're trying to do. I'd advise you to open a support case as I might have missed something.
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: set repository credentials

Veeam Logoby Andreas Neufert » Sun Apr 29, 2012 10:10 pm

just a small idea. edit one of your repositories mannual with all neccesarry settings. then copy it with powershell and do the neccesarry changes. copy instead of creating a new one. maybe this is a workaround.
Andreas Neufert
Veeam Software
 
Posts: 2201
Liked: 360 times
Joined: Wed May 04, 2011 8:36 am
Location: Germany
Full Name: @AndyandtheVMs Veeam PM


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 4 guests