Linux Powershell client : Add-PSSnapin VeeamPSSnapIn & Connect-VBRServer - powershell

Please advice me how to use : Add-PSSnapin VeeamPSSnapIn & Connect-VBRServer on a Linux Ubuntu Powershell client
Here is what I tried:
#$psversiontable Output
Name Value
---- -----
PSVersion 6.1.0-preview.2
PSEdition Core
GitCommitId v6.1.0-preview.2
OS Linux 4.10.0-38-generic #42~16.04.1-Ubuntu SMP Tue Oct 10 16:32:20 UTC 2017
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
#Connect-VBRServer Output:
Connect-VBRServer : The term 'Connect-VBRServer' is not recognized as
the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that
the path is correct and try again. At line:1 char:1
+ Connect-VBRServer
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Connect-VBRServer:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
#Add-PSSnapin VeeamPSSnapIn Output:
Add-PSSnapin : The term 'Add-PSSnapin' is not recognized as the name
of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path
is correct and try again. At line:1 char:1
+ Add-PSSnapin VeeamPSSnapIn
+ ~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Add-PSSnapin:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

According to Veeam Knowledge Base the PowerShell Module is installed with a Windows Setup File. Maybe ask Veeam directly if it's planned to support Linux?

Related

How to copy string to clipboard Powershell? Linux/Windows/Mac

I'm in the process of writing a powershell module, that aim to be distributed and I'm looking for a cross-platform (Win/Linux/MacOS) powershell ≥5.0 solution to copy a generated string to the system's clipboard.
Env
> $PSVersionTable
Name Value
---- -----
PSVersion 6.1.2
PSEdition Core
GitCommitId 6.1.2
OS Linux 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Set-Clipboard
PS ~/projects/lesspass-powershell> Get-Random | Set-Clipboard
Set-Clipboard : The term 'Set-Clipboard' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:14
+ Get-Random | Set-Clipboard
+ ~~~~~~~~~~~~~
+ CategoryInfo
: ObjectNotFound : (Set-Clipboard:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Write-Clipboard
PS ~/projects/lesspass-powershell> Get-Random | Write-Clipboard
Write-Clipboard : The term 'Write-Clipboard' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:14
+ Get-Random | Write-Clipboard
+ ~~~~~~~~~~~~~~~
+ CategoryInfo
: ObjectNotFound : (Write-Clipboard:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Out-Clipboard
PS ~/projects/lesspass-powershell> Get-Random | Out-Clipboard
Out-Clipboard : The term 'Out-Clipboard' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:14
+ Get-Random | Out-Clipboard
+ ~~~~~~~~~~~~~
+ CategoryInfo
: ObjectNotFound : (Out-Clipboard:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Solution: install module
You can install aditionnal module ClipboardText
Locate command
On Windows (PS v5.1) to know which module contains these command :
PS> get-module | ?{$_.ExportedCommands.Keys -like '*-Clipboard'}
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
Script 3.2.0.0 Pscx {Add-PathVariable, Clear-MSMQueue, Convert-Xml, ConvertFrom-Base64...}
However, this results is empty on PS v6.1 core!
get-module Microsoft.PowerShell.Management,pscx | ?{$_.ExportedCommands.Keys -like '*-Clipboard'}

How to set PITR for all databases in a Azure Sql Database Elastic Pool?

I think I'm running into version issues because the cmdlet I want seems to only be available in AzureRM.Sql module version 4.7.0-preview.
I want to set the PITR retention policy for many databases in an elastic pool to 35 days. By default my vCore pool has a retention policy of 7 days which is not enough. I have hundreds of databases so need to set them all with PowerShell.
If I get the list of databases to update with Get-AzureRmSqlElasticPoolDatabase and then try to run Set-AzureRmSqlDatabaseBackupShortTermRetentionPolicy I get this error when running the latter:
import-module : The following error occurred while loading the extended type data file: Error in TypeData "Microsoft.Azure.Commands.Sql.Replication.Model.AzureSqlDatabaseCopyModel": The member DefaultDisplayPropertySet is already present.
Error in TypeData "Microsoft.Azure.Commands.Sql.Replication.Model.AzureReplicationLinkModel": The member DefaultDisplayPropertySet is already present.
At line:1 char:1
+ import-module azurerm.sql
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Import-Module], RuntimeException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
Things I've tried
I've tried removing the module and re-importing it. Same error.
I've tried importing the required version of the module and getting the database list with the first command but I then get this error:
Get-AzureRmSqlElasticPoolDatabase : The 'Get-AzureRmSqlElasticPoolDatabase' command was found in the module 'AzureRM.Sql', but the module could not be loaded. For more information, run 'Import-Module AzureRM.Sql'.
At line:1 char:8
+ $dbs = Get-AzureRmSqlElasticPoolDatabase -ElasticPoolName $settings.E ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzureRmSqlElasticPoolDatabase:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
If I import the AzureRm module with import-module azurerm.sql I get this error:
import-module : The following error occurred while loading the extended type data file: Error in TypeData "Microsoft.Azure.Commands.Sql.Replication.Model.AzureSqlDatabaseCopyModel": The member DefaultDisplayPropertySet is already present.
Error in TypeData "Microsoft.Azure.Commands.Sql.Replication.Model.AzureReplicationLinkModel": The member DefaultDisplayPropertySet is already present.
At line:1 char:1
+ import-module azurerm.sql
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Import-Module], RuntimeException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
Modules
Get-Module AzureRm -ListAvailable | select Name, Version:
Name Version
---- -------
AzureRM 6.10.0
Get-Module AzureRm.Sql -ListAvailable | select Name, Version:
Name Version
---- -------
AzureRM.Sql 4.11.5
AzureRM.Sql 4.7.0
AzureRM.Sql 4.4.0
$PSVersionTable:
Name Value
---- -----
PSVersion 5.1.17134.228
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17134.228
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Any ideas on how to get this working?
You could try to install 4.11.4-preview version of AzureRM.Sql module, refer to this link, use Install-Module -Name AzureRM.Sql -RequiredVersion 4.11.4-preview -AllowPrerelease in the powershell administrator environment.
After installing it, no need to import module, you could excute the command straightly. If you want to check the module if installs successfully, navigate to C:\Program Files\WindowsPowerShell\Modules\AzureRM.Sql, you will find a 4.11.4 folder.
Then try the sample command to set PITR for all databases in a Elastic Pool , it works fine on my side.(You could execute Get-Help Set-AzureRmSqlDatabaseBackupShortTermRetentionPolicy to get the usage of the command)
$dbs = Get-AzureRmSqlElasticPoolDatabase -ResourceGroupName "joywebapp" -ServerName "joydb" -ElasticPoolName "joyelastic"
foreach($db in $dbs){
Set-AzureRmSqlDatabaseBackupShortTermRetentionPolicy -ResourceGroupName $db.ResourceGroupName -ServerName $db.ServerName -DatabaseName $db.DatabaseName -RetentionDays 35
}

Connect-PnPOnline : The term 'Connect-PnPOnline' is not recognized as the name of a cmdlet, function, script file, or operable program

I have windows 7 64-bit , and i have install sharepoint management shell from this link https://www.microsoft.com/en-us/download/details.aspx?id=35588.
but when i open the SP management shell and i try to run this command:-
PS C:\> Connect-PnPOnline https://*****.sharepoint.com/sites/***/
I got this error:-
Connect-PnPOnline : The term 'Connect-PnPOnline' is not recognized as
the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that
the path is correct and try again. At line:1 char:1
+ Connect-PnPOnline
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Connect-PnPOnline:String) [], C ommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
so not sure what i am missing?
Here is my version table:-
PS C:\> $psversiontable
Name Value
---- -----
PSVersion 3.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.42000
BuildVersion 6.2.9200.22198
PSCompatibleVersions {1.0, 2.0, 3.0}
PSRemotingProtocolVersion 2.2
Please install the Pnp PowerShell assembly in your system from here:
SharePoint/PnP-PowerShell
And then consume in SharePoint Online Management Shell:
Connect-PnPOnline –Url https://tenant.sharepoint.com –Credentials (Get-Credential)
It will pop up a credential window, input credential and then continue:
If the machine has Internet access and you're on PowerShell 6 or later, it's actually easier to use PowerShell-Get by running:
Install-Module SharepointPNPPowershellOnline
Note: PowerShellGet is available for earlier PowerShell versions as well, but needs to be installed first - see here.

Missing Azure cmdlets from PowerShell v5

Alrighty so I am trying to control my first Azure instance with Powershell.
I am on windows 10, I run $PSVersionTable
Name Value
---- -----
PSVersion 5.1.14393.693
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.693
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
I am trying to follow this guide: https://msdn.microsoft.com/en-us/library/mt125356.aspx
So I type "Install-Module AzureRM" That works
Then I type "Install-AzureRM"
I get:
Install-AzureRM : The term 'Install-AzureRM' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Install-AzureRM
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Install-AzureRM:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I can use "Login-AzureRmAccount" and see my subscription info. But if I attempt to use
PS C:\WINDOWS\system32> Remove-AzureADGroup
Remove-AzureADGroup : The term 'Remove-AzureADGroup' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Remove-AzureADGroup
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Remove-AzureADGroup:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\WINDOWS\system32> Get-MsolGroup
Get-MsolGroup : The term 'Get-MsolGroup' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-MsolGroup
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-MsolGroup:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Nothing is working, and every single guide I come across seems outdated by two years and refers to V2 or below for Azure PS connections.
My end goal it to delete a group from AD via cmdlet and I just cannot seem to get any of this to work.
I......feel....really silly.
So after I posted this, I came across another technet link buried in another technet blog.
Turns out I don't need ANY of the above (for what I am trying to accomplish)
Simply followed this:
https://learn.microsoft.com/en-us/azure/xplat-cli-install#option-2-use-an-installer
Then used these:
https://learn.microsoft.com/en-us/azure/virtual-machines/azure-cli-arm-commands#azure-account-manage-your-account-information
The referenced article is really, really, really old, and you are now redirected to the new page if you attempt to go there: https://learn.microsoft.com/en-us/powershell/azure/install-azurerm-ps?view=azurermps-4.1.0 . You should only need to run
Install-Module AzureRM
Also, the AzureAD module isnot part of AzureRM. There are a small set of AD cmdlets included in AzureRM that allow you to manipulate AAD users, groups, and applications, but it does not have the full AD and MS Graph support of the AzureAD mdoule

Server 2012 R2 missing PSReadline cmdlets?

Works on Win 10 but on server 2012 R2 its not there.
PS> Get-PSReadlineKeyHandler
Get-PSReadlineKeyHandler : The term 'Get-PSReadlineKeyHandler' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1
+ Get-PSReadlineKeyHandler
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-PSReadlineKeyHandler:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Can confirm I'm running v5
PS> $PSVersionTable
Name Value
---- -----
PSVersion 5.0.10586.117
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.10586.117
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
You can install it from the PowerShell gallery. But I believe you are correct that Windows 10 is the only OS that installs the module by default.
Find-Module psreadline | Install-Module