Backup Sharepoint 2010 (using Powershell - Backup-SPFarm) - sharepoint

I asked this on ServerFault, but didn't get any reply's, I know it's command line, but they should still be able to answer it, anyone here have any idea's?
I've ran the following (task description):
> Add-PsSnapin Microsoft.SharePoint.Powershell
> Backup-SPFarm -Directory E:\Backups -BackupMethod Full
But get this error:
Backup-SPFarm : Object reference not set to an instance of an object.
At line:1 char:14
+ Backup-SPFarm <<<< -Directory \\SHAREPOINTSERV\Backups -BackupMethod full
+ CategoryInfo : InvalidData: (Microsoft.Share...mdletBackupFarm:SPCmdletBackupFarm) [Backup-SPFarm], NullReferenceException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletBackupFarm
I can backup manually through the Admin site, so all the services/permissions are setup correctly.
I can't find much helpful info on this does anyone know why I'm getting this error message?
running SQL Server 2008 R2 and Win2008 Standard (x64).
tried setting the directory to a UNC path and a local path.
tried set-executionpolicy ByPass (and RemoteSigned)
I'm logged on as a user with enterprise admin security credentials
SharePoint & SQL Server are installed on the same machine
Not sure if relevent, but I'm a developer and have never used power-shell before (nor has it been used on this machine before)... so my only guess is there is some sort of pre-requisite that I am supposed to have run or know about?
EDIT:
VERBOSE OUTPUT
PS E:\Backups\Script> Backup-SPFarm -Directory E:\Backups -BackupMethod Full -Verbose
VERBOSE: Leaving BeginProcessing Method of Backup-SPFarm.
VERBOSE: Performing operation "Backup-SPFarm" on Target "SHAREPOINTSERV".
Backup-SPFarm : Object reference not set to an instance of an object.
At line:1 char:14
+ Backup-SPFarm <<<< -Directory E:\Backups -BackupMethod Full -Verbose
+ CategoryInfo : InvalidData: (Microsoft.Share...mdletBackupFarm:SPCmdletBackupFarm) [Backup-SPFarm], NullReferenceException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletBackupFarm
VERBOSE: Leaving ProcessRecord Method of Backup-SPFarm.
VERBOSE: Leaving EndProcessing Method of Backup-SPFarm.

Do you have the SQL Server and the SharePoint products installed on the same system? Or is this a farm deployment with multiple servers?
In case of a farm deployment, you have the provide a UNC path of the backup folder. At least, that is what
Get-Help Backup-SPFarm -Parameter Directory
says.
Also, can you post the output of
Backup-SPFarm -Directory E:\Backups -BackupMethod Full -Verbose

Unfortunately, as I suspected this was something simple, but took a long time to work out (thanks to Microsoft's amazingly useful error message :p )
I had opened Sharepoint Management Shell before, but as a different user, which meant I did see a vital message that would point me in the right direction...
When I set up the server, there was no need to log into SQL Server other than to set up the service accounts (I think I logged in as my user, not the enterprise admin) and the enterprise admin didn't have any SQL Server permissions.
I suspected the line Add-PsSnapin Microsoft.SharePoint.Powershell hadn't worked properly, even though it said it did.
As I was trying to create a powershell script through the powershell editor I never opened Sharepoint Management Shell as the admin user I had logged in as.
Once I had seen the message in Sharepoint Management Shell, I googled it, and problem solved.
It would have been nice of Microsoft to display this instead of the object reference message!

In the question on the technet site, you have dumped a stack trace that shows an error accessing the configuration DB info from the registry (at, I guess, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\Secure\ConfigDB).
Could you check the permissions of this key and the identity of the w3wp processes ?

Related

Receiving 'Value cannot be null' error on Parameter: source while trying to change a users profile picture in PowerShell

I'm trying to change a user's profile picture using PowerShell and I'm receiving the following error:
Error on proxy command 'Set-UserPhoto -Identity:'username_removed'
-PictureData:'255','216','255','224','0','16','74','70','73','70','0','1','1','1','0','72','0','72','0','0','2...
-Confirm:$False' to server ME3P282MB4196.AUSP282.PROD.OUTLOOK.COM: Server version 15.20.4713.0000, Proxy method RPS:
Processing data from remote server me3p282mb4196.ausp282.prod.outlook.com failed with the following error message:
[AuthZRequestId=aa213d1b-1ea1-4b2a-91b0-20d1ee30a6f7][FailureCategory=AuthZ-ArgumentNullException] Value cannot be
null.
Parameter name: source For more information, see the about_Remote_Troubleshooting Help topic.
[Server=MEYP282MB3499,RequestId=3929eae2-fd6c-4892-905d-274c7dd8b8a3,TimeStamp=3/12/2021 5:04:10 AM] .
+ CategoryInfo : NotSpecified: (:) [Set-UserPhoto], CmdletProxyException
+ FullyQualifiedErrorId : [Server=MEYP282MB3499,RequestId=3929eae2-fd6c-4892-905d-274c7dd8b8a3,TimeStamp=3/12/2021
5:04:10 AM] [FailureCategory=Cmdlet-CmdletProxyException] 503E4E16,Microsoft.Exchange.Management.RecipientTasks.S
etUserPhoto
+ PSComputerName : outlook.office365.com
I'm only doing this through PowerShell as a last resort as I received a similar error while trying to change the picture in Microsoft 365, the Azure portal and the user was unable to change it on their end.
edit: These are the commands I was running in PowerShell:
Connect-ExchangeOnline -UserPrincipalName <myemailaddress_removed> -DelegatedOrganization <tenant_id_removed>
Set-UserPhoto -Identity "IdentityRemoved" -PictureData ([System.IO.File]::ReadAllBytes("<path to file removed>"))
edit: I've tried uploading the profile picture to a test account in Azure and it was applied without issue so the trouble seems to be with this particular user's account

Not able to disable Azure AD Connect

I'm looking for a solution to my problem and I am not able to find it. I've tried everything online.
I'm trying to disable our on premise AD connect, I ran it as a test but it turns out our environment is not setup correctly for this to work and requires some restructuring.
I've followed the standard instructions of
Connect-MsolService and Set-MsolDirSyncEnabled -EnableDirSync $false
Connect works fine but when I try to run the disable command it returns back the error Set-MsolDirSyncEnabled : You cannot turn off Active Directory synchronization.
I've been told it could take a while but I had enabled it last week and most resources I've found say "24 - 72 hours".
The command (Get-MSOLCompanyInformation).DirectorySynchronizationStatus shows Enabled and not syncing.
Can anyone assist me with this issue?
Thank you!
You try to enable (or disable) Directory synchronization in Office 365, and you are greeted by the following error message.
PS C:\> Set-MsolDirSyncEnabled -EnableDirSync $false
Set-MsolDirSyncEnabled : You cannot turn off Active Directory synchronization.
At line:1 char:1
+ Set-MsolDirSyncEnabled -EnableDirSync $false
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [Set-MsolDirSyncEnabled], MicrosoftOnlineException
+ FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.DirSyncStatusChangeNotAllowedException,Microsoft.Online.Administration.Automation.SetDirSyncEnabled
The DirSyncStatusChangeNotAllowedException error in particular means that you have changed the status recently, and the service is simply preventing you from changing it back too soon
Note : The error message detailed is different and will occur even if the
DirSync status has been updated. It’s a simple block on Microsoft’s
side to prevent you from changing the status too often
check now or wait for atleast 12 hours to 72hr to reflect.
MSOLCompanyInformation | select DirectorySynchronizationStatus
NO FIX: Unfortunately, there is no way around this error. It simply means that your directory is still doing a full initial synch with Azure AD. This error message will clear once the initial sync is complete. The time will vary depending on the size of your on-premises AD but should take no longer than 72 hours for very large environments.
Reference : https://www.michev.info/Blog/Post/1797/you-cannot-turn-off-active-directory-synchronization
Note : If still problem is not getting solved would suggest you to reach out to MS Support. They can able to track down where the exact. issue

TaskCanceledException on Start-ComplianceSearch

I'm at my wits end with this one. I'm trying to start a compliance search in the Microsoft Compliance Center and I'm running into this error.
Creating SearchA task was canceled.
+ CategoryInfo : WriteError: (:) [Start-ComplianceSearch], TaskCanceledException
+ FullyQualifiedErrorId : [Server=BL2NAM02WS018,RequestId=3311342e-a545-4a5f-9fa1-2e9999b0d901,TimeStamp=6/5/2019 7:49:02 PM] [FailureCategory=Cmdlet-TaskCanceledException] 821
CC486,Microsoft.Office.ComplianceJob.Tasks.StartComplianceSearch
+ PSComputerName : nam02b.ps.compliance.protection.outlook.com
It's pretty simple code, I'm just doing this...
Start-ComplianceSearch -Identity "Test Search Name" -Force
I've verified I created the search correctly in compliance center (via Powershell), and I can run it from the UI.
Anyone have any ideas where to start debugging this? Any help is much appreciated!!!
Thanks for the comments above.
This just magically worked today. I think the Google search results that said internal Azure Error ended up being correct.
If anyone else hits this, just one other thing that may have caused this other than an Azure hiccup. You can only have 3 sessions going to the Security and Compliance Center at one time. We may have had some hung PowerShells running the in the background that would have increased our session count past 3.
TL;DR - This an Azure internal error. Report it to Microsoft.

SharePoint 2013 :- Web Application taking forever to create

I have a SharePoint 2013 installation on a Window 8 machine.
I am trying to create a web application and it is taking forever. The creation process never stops. I checked in application event logs and found this error:
*Machine 'SHAREPOINT2013C (SharePoint - 43000(_LM_W3SVC_1458308317_ROOT))' failed ping validation and has been unavailable since '1/22/2013 3:56:48 AM'.*
Searched the web but could not find anything that works for me.
Can anyone suggest a way to resolve the issue? Thanks a lot in advance.
Below are my findings:
In order to recognize routing targets IIS has to be able to process SPPING HTTP method
To test run this code in Powershell:
$url = "http://your-Routing-Target-Server-Name"
$myReq = [System.Net.HttpWebRequest]::Create($url)
$myReq.Method = "SPPING";
$response = $myReq.GetResponse();
$response.StatusCode
If you get the following error message:
Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (405) Method Not Allowed."
that means that web front end is not set up to process SPPING HTTP method
To resolve the issue run the following commands on each routing target server:
Import-Module WebAdministration
add-WebConfiguration /system.webserver/handlers "IIS:\" -value #{
name = "SPPINGVerbHandler"
verb = "SPPING"
path = "*"
modules = "ProtocolSupportModule"
requireAccess = "None"
}
This will add a handler for SPPING verb to IIS configuration.
Run the test script again to make sure this works.
So this has to do with the Request Management Service that runs on the WFE servers on SharePoint 2013. The Request Management Service is of no value since you only have one server. If you disable this service on your single server farm these messages will go away and your Web Application creation performance will greatly increase.
Mark Ringo
I recently faced this issue, I created new Web Application and it was showing a popup of "It shouldn't take long", then after some time it showed a Connection failure page. I browsed to the virtual directory folder for the new web application and found that the folder was totally empty.
Then what I did to solve this problem:
1. Open IIS
2. Go to Applicatin Pools
3. Select Central Admin application pool and right click and select "Advance Settings".
4. There was a property named "Shutdown Time Limit", it was set to "90" by default. I changed it to 400 and clicked OK.
It restarted the applicaition pool automatically. Then again I created new web application from central admin and it worked for me.
I've found that these events correlate to when the specified application pools are recycled (mine are at a specific time in the morning). It's unfortunate that they're logged in the event viewer and can't really clean it up.

Enable RemoteApp Full Desktop programmatically

I am writing a powershell script to set up some HyperV VM's however there is one step I am having trouble automating. How do I check the box to allow Remote desktop access from the RemoteApp settings programmatically?
I can set up all of my customizations I need by doing
#build the security descriptor so the desktop only shows up for people who should be allowed to see it
$remoteDesktopUsersSid = New-Object System.Security.Principal.SecurityIdentifier($remoteDesktopUsersGroup.objectSid[0],0)
#get a copy of the WMI instance
$tsRemoteDesktop = Get-WmiObject -Namespace root\CIMV2\TerminalServices -Class Win32_TSRemoteDesktop
#set settings
$tsRemoteDesktop.Name=$ServerDisplayName
$tsRemoteDesktop.SecurityDescriptor= "O:WDG:WDD:ARP(A;CIOI;CCLCSWLORCGR;;;$remoteDesktopUsersSid)"
$tsRemoteDesktop.IconPath = $IconPath
$tsRemoteDesktop.IconIndex = $IconIndex
#push settings back to server
Set-WmiInstance -InputObject $tsRemoteDesktop -PutType UpdateOnly
however the instance of that WMI object does not exist until after you have the above box checked.
I attempted to use Set-WmiInstance to instantiate and set the settings at the same time but I keep getting errors like:
Set-WmiInstance :
At line:53 char:16
+ Set-WmiInstance <<<< -Namespace root\CIMV2\TerminalServices -Class Win32_TSRemoteDesktop -Arguments #{Alias='TSRemoteDesktop';Name=$ServerDisplayName;ShowInPortal=$true;SecurityDescriptor=$securityDescriptor}
+ CategoryInfo : NotSpecified: (:) [Set-WmiInstance], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.SetWmiInstance
(also after running the command and getting the error it will delete the instance of Win32_TSRemoteDesktop if it already exited and un-check the box in the properties setting)
Is there any way to programmatically check that box or can anyone help with why Set-WmiInstance throws that error?
You could use the Remote Desktop Services Provider for Windows PowerShell module if you are running windows server 2008 R2.
You can read up about it on technet hear is the link.
I used this guide for all my needs .

Resources