Translate

Thursday, July 2, 2020

Azure Storage Container - Get blob/file names using PowerShell

We often create Azure storage containers to store files. These files could be for importing to your Office 365 blob or anything else. Below is a script that will help you generate the names of all files in your container. What you need to provide is the storage account name, container name and sas token of the container.

Connect-AzAccount
$StorageAccountName = 'o365'
$ContainerName = 'dev'
# Creates a storage context
$sasToken = 'Paste SAS token URL here'
$StorageContext = New-AzStorageContext $StorageAccountName -SasToken $sasToken
#listing the file names
$fileNames = Get-AzStorageBlob -Container $ContainerName -Context $StorageContext | select Name
$fileNames | out-file "D:\Raj\Log\FileNames.txt"
Disconnect-AzAccount

Sunday, June 21, 2020

OneDrive for Business - Issues and Fix


I have recently completed OneDrive to OneDrive migration and during the migration, there were several issues which I have encountered. I am trying to put together some of them below.

  1. Error Code: 0x8004deb4 : There was a problem signing you in. Login was either interrupted or unsuccessful. Please try logging in again. (Error Code: 0x8004deb4)
      


          Solution :
  1. Click on run > regedit
  2. Navigate to HKEY_CURRENT_USER\SOFTWARE\Microsoft\OneDrive
  3. Search for EnableADAL key. If the key is available and the value isn’t 00000002, change it to 00000002.
  4. In the case that it is unavailable, create a new DWORD(32-bit value) and set the value to 00000002
  5. Close the registry and restart the laptop.
2. Error Code: 0x8004deea : 


  1. Click on start Menu > Run
  2. Type Regedit > Enter 
  3. Navigate to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\OneDrive|AllowTenantList and Search for your tenant ID. 
  4. If the tenant ID isn't available, create a new DWORD key and add your O365 tenant id.
  5. The change requires admin rights in the system and post addition, run the below steps.
  6. Go to command prompt and run Gpupdate /force
  7. Restart the machine.
3. Error Code: 0x8004deef

     The error code appears in the OneDrive client while logging in when OneDrive site isn't provisioned for the user. Please navigate to SharePoint user profile and check if the user has OneDrive site. If there isn't, provision OneDrive for the user.

4. Restrict OneDrive Personal Sync in your organization 

    Many organization do not realize that Microsoft offers OneDrive personal with Microsoft accounts and it is free up to 5 Gb. Users using OneDrive personal can sync their OneDrive personal data in organization devices and legal/security doesn't like that. To prevent OneDrive personal from syncing, we have to add a registry key. Navigate to the below and add a new key DisablePersonalSync and add value 1. 

To add the key in all machines, you need to take help from your SCCM team to update the registry using GPO.

Computer\HKEY_CURRENT_USER\Software\Policies\Microsoft\OneDrive










5. Error code : 0x8004de69
     - Pause syncing the OneDrive
     - Close the OneDrive
     - Navigate to Control Panel -> Credential Manager -> Windows Credentials and delete all Generic Credentials containing OneDrive
     - Navigate to OneDrive website
     - Click Sync - this will open OneDrive in Windows and should resolve the issue


Friday, May 3, 2019

eDiscovery - Put mailboxes On Litigation Hold using PowerShell Script


O365 administrators can use GUI to put SharePoint sites, ODB, mailbox on litigation hold. Microsoft eDiscovery UI helps admins to create a Case and apply Hold to mailboxes. However, there are PowerShell scripts available to put mailboxes On Litigation Hold and you do not need to create Cases for it. 

Below is how we do that  -

1. Connect to Exchange Online

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session –DisableNameChecking

2. Check Litigation Status of the mailbox

Get-Mailbox -identity rajdeepc@onmicrosoft.com |fl Identity, LitigationHold*

3. Put the mailbox on hold

Set-Mailbox -identity rajdeepc@onmicrosoft.com -LitigationHoldEnabled $true

4. (Optional) Use the content search to get collection for your legal team

5. Release the mailbox if it is not needed to be On Litigation Hold

Set-Mailbox -identity rajdeepc@onmicrosoft.com -LitigationHoldEnabled $false

6. Disconnect the session (Must do to ensure the session is not occupied)

Remove-PSSession $Session



Wednesday, May 1, 2019

Enable SPO Site Collection App Catalog


By now everyone knows how to enable Site Collection App Catalog in SharePoint Online. It is simply to run the commands like below -

Connect-SPOService -Url {SharePointAdminSiteURL} -Credential rajdeep@domain.net
$site = Get-SPOSite {SiteCollectionURL}
Add-SPOSiteCollectionAppCatalog -Site $site

You may encounter an error like "Must have Manage Web Site permissions or be a tenant admin in order to add or remove sites from the site collection app catalog allow list". This is because if the person who's executing the command is not admin in the App Catalog site.

Add rajdeep@domain.net as admin in the site collection app catalog and run it again.

Wednesday, January 30, 2019

Backup and Restore Project Server Sites 2013

The below article outlines how to take backup and restore Project Server sites from one tier to another. The steps are tested successful in SharePoint/Project Server 2013 farm. The process assumes that you already have the Project Server database and content database backup files available from the backup/restore team.
First we will start by dismounting the existing running instances. Please have communication out for the downtime your application/site will have during the process.

  • Dismount-SPProjectWebInstance -SiteCollection  <URL of PWA site that we want to refresh>
  • The Project Server service application in CA the project site should have been removed
  • Next we will dismount the content database - Dismount-SPContentDatabase “<Content Database name here>”
  • Launch SQL server and restore the SQL database backups you have received from the B/R team.
  • Mount the restored content database in the web application - Mount-SPContentDatabase “<restored content database in previous step>” -DatabaseServer “<SQL Server>” –WebApplication <web application URL>
  • Mount the restored project server database - Mount-SPProjectDatabase -Name “Name of the restored Project database” –WebApplication “Web Application URL that the Project Web App database will mount to” –DatabaseServer “SQL Server where the database was restored”
  • Provision the Project Web App site collection - Mount-SPProjectWebInstance –DatabaseName “Restored Project Web App database” –SiteCollection “site collection URL including the PWA path” –DatabaseServer “SQL Server where the database was restored”
  • We can check the provisioning status using - Get-SPProjectWebInstance -URL "https://...." | Select ProvisioningStatus
If your farm is managed by different administrative accounts, you may have to consider adding the correct account permission in the newly provisioned project site. For that navigate to - CA > Manage Service Apps > Project Server Service App and choose to Edit the Project Server Instance, modify the Administrator account to be the correct account.

If Excel service reports are in use, will need to update to use the ODC files from correct environment. 

Thursday, July 19, 2018

START or STOP App Fabric Caching service using PowerShell

START or STOP App Fabric Caching service using Power Shell

App Fabric or Distributed Caching service can be started using services console or from the central admin UI. However, I find it easy to start it using power shell. Copy and paste the below code in a notepad and save it as .ps1 file. The script file can be executed from the distributed cache server/s.

START App Fabric Caching Service
$instanceName =”SPDistributedCacheService Name=AppFabricCachingService”
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
$serviceInstance.Provision()

STOP App Fabric Caching Service
Stop-SPDistributedCacheServiceInstance –Graceful

After the service is started, from the DC server, type the below two commands to ensure that your service is UP.

Use-CacheCluster
Get-CacheHost

Now about the verification. First verification should be in the services.
1. Click on Start > Run > type services.msc > Enter
2. Ensure the App Fabric Caching service is running.

The next verification is from the Central Administration.
1. Navigate to Central Administration > Click on services on server
2. Select the server from the dropdown where your DC is configured
3. Ensure the Distributed Cache status is Started.

Hope this helps !