Tag Archives: Top sharepoint hosting

SharePoint 2013 Hosting – ASPHostPortal.com :: How to Add or Remove A New User to SharePoint Group Using Powershell Script

How to Add or Remove A New User to SharePoint Group Using Powershell Script

In SharePoint site you can see usually a lot of groups. Sometimes administrator gets a task to add user to several groups. If it’s 3-5 groups you can do it manually, but if you need to add user to 30 groups? I’m too lazy to do it manually and too smart not do it at all.

SharePoint 2013 Hosting

  1. Start your windows PowerShell on your computer.
  2. Right click and select Run as administrator option.
  3. Paste the below script on the PowerShell window and click the enter button.
  4. Check your SharePoint site Feature will activated successfully.

So let’s start out PowerShell ISE and connect SharePoint CMD-let:

if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) 
{ 
 Write-Host "Connect Sharepoint cmd-Let" 
 Add-PSSnapin Microsoft.SharePoint.PowerShell 
}

Let’s enter site collection url, username for inserting to groups and get array of destination SharePoint groups. For example, let this groups contain a string “admin”

$url = "http://user"
$userName = "user\testuser1"
$site = new-object Microsoft.SharePoint.SPSite($url) 
$web = $site.OpenWeb() 
$groups = $web.sitegroups
write-host "------get array of groups which contain a string "admin"-----" 
$myGroups = @(); 
foreach($group in $groups) { 
if($group -match "admin") { 
$myGroups += $group 
}

Go through each element of array and add user to SharePoint group

foreach ($gr in $myGroups) { 
#add user to SP Group
 Set-SPUser -Identity $userName -web $url -Group $gr 
 write-host "User " $userName "added to " $gr 
}

And if you made a false and, for example, entered wrong username, you can easily remove user from SharePoint groups with this PS-code:

foreach ($gr in $myGroups) { 
 $theGroup = $web.SiteGroups[$gr] 
 $theUser = $web.AllUsers.Item($userName) 
#Remove user from SP Group
 $theGroup.RemoveUser($theUser); 
 write-host "User " $userName " removed from " $gr
}

If you don’t want to collect these pieces here’s a full version:

if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) 
{ 
 Write-Host "Connect Sharepoint cmd-Let" 
 Add-PSSnapin Microsoft.SharePoint.PowerShell 
}
$url = "http://user"
$site = new-object Microsoft.SharePoint.SPSite($url) 
$web = $site.OpenWeb() 
$groups = $web.sitegroups 
$userName = "user\testuser1" 
write-host "--------------" 
$i = 0; 
$myGroups = @(); 
foreach($group in $groups) { 
 if($group -match "admin") { 
 $myGroups += $group 
 } 
} 
foreach ($gr in $myGroups) { 
 write-host $gr 
#add user to SP Group
 Set-SPUser -Identity $userName -web $url -Group $gr 
 $theGroup = $web.SiteGroups[$gr] 
 $theUser = $web.AllUsers.Item($userName) 
#Remove user from SP Group
# $theGroup.RemoveUser($theUser); 
 write-host "User " $userName "added to " $gr 
}

If there are non-english letters in a group name or if the group you need is on another site (but in this site collection), then you can have error on Set-SPUser command. In this case I can advice you to use another command $web.SiteGroups[group name].AddUser(user)

foreach ($gr in $myGroups) { 
 Write-Output "Группа: $gr " 
#alternative way to add user to SP Group 
 $theUser = $web.AllUsers.Item($userName)
 $web.SiteGroups[$gr].AddUser($theUser) 
 Write-Output "User $userName added to $gr" 
}

Cheap and Recommended SharePoint 2013 Hosting

ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability.

SharePoint 2013 Hosting – ASPHostPortal.com :: Creating Web Application From Existing Content Database

There are situations where you want to propagate one SharePoint web application to some other farm/machine. I feel the fastest way is to take content database backup and restore it in your destination farm. I have done so in last couple of weeks and I have leaned how to quickly do that. I was provided with content database backup and source code. That makes be able to restore site and generate wsps from source code.

banner promo-01Creating  content database from backup

Go to your database server and do following:

  • Create a blank database that will be used as content database
  • Restore a database using content database back up from source farm.

Creating a web application:

  • Go to sharepoint central administration and create a new web application
  • While creating a new web application, use existing content database in database section
  • Sometimes if your database is too large, web application creation takes too long and times out. Don’t worry at all. web application is still created successfully. It happened to me 4 times out of 5.

Validating the web application:

  • Go to sharepoint central administration, click on application management. In “Databases” section you will find “Manage content databases”
  • Choose your application and it will show database status and number of site collections. If you are not sure how many site collections are there in backup, anything greater than 0 is good news.

Configure web application to work properly. we are almost done now. Do following:

  • Go to sharepoint central administration
  • Click on “Application Management”
  • In “Site Collections” section click on “Change site collection administrators.
  • choose your web application set proper data in site admins.

Additional optional steps:
After performing all the above steps, it is still possible that you are not able to access your web application.

  • Last thing to do is to install and deploy wsp by using stsadm or your favorite method.

Conclusion:

It is always challenging to move applications from one farm to another. Specially when they are depending upon other service applications. In spent last two weeks to learn how to properly do that. I hope this will help you at some point during your sharepoint development.

SharePoint 2013 Hosting with ASPHostPortal.com :: Move Your SharePoint to Cloud Server

Move Your SharePoint to Cloud Server

cloudserverSharePoint is a browser based platform that can boost the efficiency and effectiveness of your organization by enhancing communication and collaboration as well as streamlining the management of and access to your data.

SharePoint can store your documents in a central, secure location, then allow users to search it for instant access to the data they need. It also enables users to share information across your intranet, whilst ensuring users see only the data that is useful and relevant to them.

SharePoint in the cloud brings enhanced document management capabilities to ensure the integrity of documents stored on team sites: the option to require users to checkout documents before editing, the ability to view revisions to documents and restore to previous versions, and the option to set document and item-level security.

Moving your content from on-premises storage to the cloud offers many benefits. In this article, we will tell you why you should move your SharePoint to the Cloud?

Here are five tips for a successful SharePoint migration:

Clean up your content

Before beginning your SharePoint migration, determine what information to move to the cloud and what you should leave behind. Weeding out any redundant, outdated or trivial content before the migration should make the process easier, while also controlling costs and mitigating risks.

Automate cleanup processes

Deciding whether to delete, migrate or archive each piece of content is time-consuming, so look for ways to automate and streamline the process by using simple rules based on date, author and location.

Take inventory

To minimize errors and unwelcome surprises during your SharePoint migration, take inventory of the content you plan to move and acknowledge the intricacies of the source before you test or migrate to a new destination. The best way to go about this is to truly investigate your content and acknowledge the different object types involved. This inventory may be very granular, including number of versions, quantity of metadata and associated lookup columns within SharePoint or another site collection.

Test your migration before you commit

When moving from SharePoint on-premises to SharePoint Online, it’s important to address the different object types and their migration paths. Each object type is going to have a different migration path with its own challenges. In a test migration, you collect a smaller set of files from the source and move it to the destination, and then make sure all the attributes that you want come over with the files. It also gives you a chance to address any errors and complications, and test the transfer speed. Testing by object type helps you acknowledge the types of content and objects that have to move and any complexities you may run into with each of them.

Set a generous timeframe

Cloud migrations tend to take longer than migrating between two SharePoint on-premises systems. While cloud migration tools may claim to transfer a gigabyte per hour, your actual speed depends on a number of factors and network complexities. Moving data between completely separate data centers may result in low transfer rates, around 100 MB or 250 MB per hour. When you’re dealing with terabytes of data, such a slow rate could put you behind schedule. That’s why it’s important to look for ways to speed up the process.

In the end, to get the best results from your SharePoint migration, it’s important to set appropriate expectations and timeframes. For example, content cleanup may take considerable time depending on your information, cleanup goals and strategy. But considering the potential benefits of streamlining the migration and improving system performance, there’s no sense in cutting corners.

Recommended SharePoint Cloud Server

Are you looking for a recommended hosting provider for your new cloud server? ASPHostPortal.com is the answer.

Why ASPHostPortal.com?

With Windows Dedicated Cloud Server Services from ASPHostPortal.com, you’ll find the perfect Cloud Server solution for your business. Web pages will load faster for ecommerce customers, databases will get higher IOPS and applications streaming large volumes of video and media files will experience low latency when customers run their applications. With cloud servers, you have the ability to upgrade and downgrade your servers on the fly. In some cases depending on the Operating System running on the cloud server it may still require a reboot. Migrating your cloud server to a different physical server can usually be accomplished with no downtime via hot migration.