Export SPWeb SharePoint 2010 weird dll error - powershell

Ik get a weird error when running the following command:
PS C:\> Export-SPWeb -Identity http://dfz-85:81/ -Path "C:\temp.cmp"
This is the error i get, the .dll file keeps changing every time i try the command.
Export-SPWeb : Could not find file 'C:\Users\cmsadmin\AppData\Local\Temp\mlilsk
gt.dll'.
At line:1 char:13
+ Export-SPWeb <<<< -Identity http://dfz-vm85:81/ -Path "C:\tmep.cmp"
+ CategoryInfo : InvalidData: (Microsoft.Share...CmdletExportWeb:
SPCmdletExportWeb) [Export-SPWeb], FileNotFoundException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletExportWeb
Any help is appreciated.

I faced the same error. Could not find the reason but could successfully export from central admin > backup restore option.

Came across this issue and eventually resolved it. Not sure what the actual solution was but the steps I took were:
Add logged in user as SP Shell Admin on the content database you're exporting/importing from/to
Close the SharePoint 2010 Management Shell window
Reopen the SharePoint 2010 Management Shell window with the Import system modules option (right click on the icon in Windows 7)

I ended up avoiding the issue and exporting/importing with SharePoint designer.
This can only be done under "All Files" and on each individual file, afaik.

Related

How to fix "Object reference not set to an instance of an object" error when running Get-AzDataLakeStoreChildItem cmdlet?

I'm getting an error while running the Azure cmdlet in Powershell. How do I resolve this?
I'm trying to get details of folders and files present in Azure datalake through powershell. I'm able to access the data lake through portal and access all files.
Using Azure cmdlet I've tested the connection using "Test-AzDataLakeStoreAccount -Name $Server" and it works fine too. However, when I execute the below command, it throws null pointer exception. How to resolve that?
**Get-AzDataLakeStoreChildItem -Account "****.azuredatalakestore.net" -Path "/" **
Get-AzDataLakeStoreChildItem : Object reference not set to an instance of an object.
At line:1 char:1
+ Get-AzDataLakeStoreChildItem -Account "entadls8cc9b872.azuredatalakes ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzDataLakeStoreChildItem], NullReferenceException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.DataLakeStore.GetAzureDataLakeStoreChildItem
I can reproduce your issue in both windows powershell and azure cloud shell. It looks like a bug about the powershell module Az.DataLakeStore.
I tried Get-AzDataLakeStoreChildItem -AccountName "AccountName" -Path "/test/" which is the same as the sample in the doc, also got the same error. I also tried the Get-AzDataLakeStoreItem -AccountName "AccountName" -Path "/test/123.txt" and Test-AzDataLakeStoreItem -AccountName "AccountName" -Path "/test/123.txt", both got an error like below.
I find a github issue related to this error: https://github.com/Azure/azure-powershell/issues/8352. I think the format of the commands I have tried should be correct. The comment in this issue said 'To use datalake az module you have to use it in netcore powershell (not windows powershell)', but as I know, the Az module is cross-platform, it is not a reason, according to the doc. Another comment said the 'we have fixed this issue. Apologize for the inconvenience. It will be released as part of next release.'

WebDAV and Powershell and Windows - weird error and behaviour

We have a WebDAV site that runs on IIS. From PowerShell we try to download a folder info
Get-ChildItem \\webserver#SSL\davwwwroot\webdav\Folder1\Folder2 -Name
It says
'\\webserver#SSL\davwwwroot\webdav\Folder1\Folder2' because it does not exist.
At GetWebDAVFolderContents.ps1:33 char:10
+ $items = Get-ChildItem $url -Name
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (\\webserver#SSL\...der1\Folder2:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
The folder does exist. The very strange things: we start the File Explorer on that client PC, enter an URL like https://inside.mycompany.com/it/site which is a WebDAV site on our company's SharePoint site, then it asks for a login. After successful login to this site, the PowerShell script begins to work, drops no error anymore, and can download the Folder1\Folder2 info from our WebDAV site.
Why? How can I avoid to manually enter a login information to another site to get this script work? Is it because our WebDAV site is not correctly configured under the IIS?
It happens that a local service named "WebClient" is needed to be started. By default it is "manually" start with "trigger". It seems that the powershell way it won't trigger the service start, but the explorer thing will. As it remains started the powershell script suddenly works. The solution is to change the service start to automated, and 'till now it works.

Set-SPBusinessDataCatalogThrottleConfig : Cannot bind parameter 'Identity'

If you are working with a larger external list (more than 2000 items) in dev environment it works perfectly, but when you work in production environment, it throws error
"Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator. Correlation ID: ...........".
So start to working to fix the BCS limit through powershell.
When I enter below command in powershell I get error in cmd. Any idea?
PS C:\Program Files\Nintex\Nintex Workflow 2010> Set-SPBusinessDataCatalogThrott
leConfig -Identity Get-SPBusinessDataCatalogThrottleConfig -Scope ThrottleType I
tems Database-GUID-ServiceApplicationProxy 5222b2db-fdd1-43f5-accb-7f039155f654-
8000-default maximum 6000
Set-SPBusinessDataCatalogThrottleConfig : Cannot bind parameter 'Identity'. Can
not convert the "Get-SPBusinessDataCatalogThrottleConfig" value of type "System
.String" to type "Microsoft.SharePoint.BusinessData.SharedService.ThrottleConfi
g".
At line:1 char:50
+ Set-SPBusinessDataCatalogThrottleConfig -Identity <<<< Get-SPBusinessDataCat
alogThrottleConfig -Scope ThrottleType Items Database-GUID-ServiceApplicationPr
oxy 5222b2db-fdd1-43f5-accb-7f039155f654-8000-default maximum 6000
+ CategoryInfo : InvalidArgument: (:) [Set-SPBusinessDataCatalogT
hrottleConfig], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.SharePo
int.BusinessData.SharedService.SPSetSPBusinessDataCatalogThrottleConfig
At first glance there seems to be some issues in your PowerShell syntax. You specify another cmdlet as value for the -Identity parameter, and that won't work. Sharepoint is not really my expertise, but this article by lionelro on the msdn blogs looks like a good place to start. Especially since the start of the article describes your issue online appearing on the production environment. Hope it helps.

Open a Solution from the Package Manager Console

I'm trying to automate the process of opening a solution from source control.
I have VS12 open, but no solution or project open. Is it possible to change directories and then open a solution from the Package Manager Console?
(This is kind of beside the point, but in case there is a better way overall to do this) I'm trying to script this so that a powershell module installed via nuget could be run:
PM> Get-MyProject 'SomeName'
The module would then from pwd get the latest source cd into it and open the solution. My module can already get the source, but I'm not able to figure out how to open the solution in powershell. It seems like $dte should be able to do it, but I tried:
PM> $dte.Solution.Open('NugetTest.sln')
I get back the error
Exception calling "Open" with "1" argument(s): " could not be found. (Exception from HRESULT: 0x80030002 (STG_E_FILENOTFOUND))"
At line:1 char:1
+ $dte.Solution.Open('NugetTest.sln')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : COMException
The default directory for the package manager console (unless you have defined a profile where you change it) is %userprofile%. Probably not the place where your solution sits. If you write a powershell script and place it in your solution directory, then execute it from the Power Shell Console, you can get the path of your solution doing this:
$path = Split-Path -parent $MyInvocation.MyCommand.Path
You can create a solution like this:
$solution = $dte.Solution
$solution.Create("C:\Temp", "MySolution.sln")
The first argument indicates the directory where you want to create the solution, the second one is the name of the solution itself.
To open an existing solution:
$solution = $dte.Solution
$solution.Open("<path to your solution>")
If it doesn't work, your path is probably incorrect.

SharePoint 2010: Problem trying to install web part using power shell

I'm trying to deploy my first web part on 2010. I developed a web part using VS2008 and tested it on SP2007.
I copied the CAB to the 2010 server and tried to use the power shell to install it:
PS C:\Users\sa_portalt> Install-SPWebPartPack -LiteralPath "c:\transfer\webparts\redirectwebpart.cab" -Name "RedirectWebPart"
Install-SPWebPartPack : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:22
+ Install-SPWebPartPack <<<< -LiteralPath "c:\transfer\webparts\redirectwebpart.cab" -Name "RedirectWebPart"
+ CategoryInfo : InvalidArgument: (:) [Install-SPWebPartPack], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.SharePoint.PowerShell.SPCmdletInstallWebPartPack
What am I doing wrong? Is this the right way to install web parts?
If you can, I recommend you upgrade to Visual Studio 2010 which has built-in support for SharePoint 2010. When you build a project built from the SharePoint template it will create the wsp for you. You can also immediately deploy to the local server from VS2010 so you never need to get into PowerShell on your local development machine.
When you need to deploy to a different server, you can then run
Add-SPSolution -LiteralPath C:\webparts\MyWebPart.wsp to add the solution to Central Administation
and then
Install-SPSolution -Identify MyWebPart.wsp -WebApplication http://mySharePointserver to deploy the solution to the specified web application
This was the first article I found that provided the actual answer, however, in the Install-SPSolution, there is a typeo, the -Indentify parameter should be -Identity
Also, in most cases (if adding to the GAC) need to add the -GACDeployment to the Install-SPSolution.
So the line should look like:
Install-SPSolution -Identity BasicWebPart.wsp -WebApplication http://vsp -GACDeployment