Different Uses of PowerShell With SharePoint? - sharepoint

Following the release of SharePoint 2010, there has been renewed interest in using PowerShell to manage SharePoint solutions. I'm interested in finding out how my peers are currently using PowerShell with SharePoint, either 2007 or 2010.
For example, I use a PowerShell script to determine the number of sites, sub-sites and pages that have been created in specific web applications. Can you provide details of how you make use of PowerShell?

We're developing some custom SP2010 software. We're using Powershell cmdlets to install and upgrade builds on our test machines, as well as do some initial configuration tasks such as deploying features to certain webs, and creating service apps & service app proxies.
Unfortunately the cmdlets don't seem to play well with PSRemoting, which makes automated build & deploy trickier.

I use PowerShell for installation and debugging purposes. I'm surprised that you haven't used Powershell with SharePoint 2010.
I write quite a few scripts for deploying and managing many solutions. For Example, Every time we deploy our PerformancePoint dashboards, it removes the top the global navigation. I use a Powershell script to re-insert the global navigation based on a XML File that I have created.

Related

Sharepoint powershell cmdlets with Node/SPFX

I'm administering a Sharepoint Online site right now. Is there a way to run Sharepoint powershell cmdlets externally from SPFX/ NodeJS. I'm trying to create a UI for disabling versioning for a document library. Seems that disabling versioning could only be achieved through powershell right now.
(Or is there an sharepoint api endpoint for actually doing it, not sure)
You cannot run powershell cmdlets from SPFx. SPFx is a framework to build applications that run in a browser.
But you can use REST API (the easiest way to use it is probably pnpjs to wrap it). You could try something like this (just update the library property):
await sp.web.lists.getByTitle("Documents").update({ EnableVersioning: false });

Why would I want to install SharePoint with TFS

I'm looking at upgrading my current TFS instance and planning to copy and restore databases as per Microsofts Advanced Upgrade which means I am pretty much installing the new product from scratch and restoring the databases then running a migration tool.
I see in the installation notes that you can integrate SharePoint with it as an optional extra. Why would I do this? Is the idea to store project documentation in a SharePoint Document library per project and be able to link to that content rather than as an attachment to the Backlog Items and Bugs in TFS?
I'm having trouble finding any documentation of team workflows with SharePoint and TFS and I suspect that its because no one really does it.
More importantly would SharePoint integration impede future product upgrades or moving to Visual Studio Online?
In my eyes, SharePoint as a TFS portal has become much less desirable due to the improvements in Team Web Access (eg Charting) but it still has some uses.
With the integration enabled, you will see a Documents tab in Team Explorer which will take you to the dedicated SharePoint Portal (created when you create the TFS Team Project) where all your documentation can be stored. Of course without SharePoint integration you can still happily link Work Items to documents in SharePoint, you just don't have a dedicated portal created for you.
If you are using one of the MSF process templates then some useful documents are created for you on SharePoint when you create the Team Project (xlsx reports etc). However, if you are using the much better VS Scrum template then no documents are created even if you have SharePoint integration enabled.
If you are using the Enterprise edition of SharePoint then you get some good dashboards (bugs, code quality etc.) and you can also publish your custom excel reports easily. This functionality requires Excel Services and so is not available in the standard edition (there are some dashboards created but they aren't that useful).
Share information using the project portal
https://msdn.microsoft.com/en-us/library/ms242883.aspx
Your team can use the SharePoint portal to share information in the following ways:
Share data contained in reports or dashboards
Share team progress using predefined or customized dashboards.
Share documents, files, images.
Share team knowledge and processes using the SharePoint wiki.
Reference process guidance for select team project artifacts.
If you want to add a portal to an existing project:
Configure or add a project portal
https://msdn.microsoft.com/en-us/library/ms242865.aspx

Saving complete azure configuration to file?

Is there any way to save the complete state of my azure configuration?
Basically, I just created a demo for a project I'm working on. This demo has a website/webjob, scheduler, storage queue, storage blob, redis cache and documentDB. I have configured these components in terms of size/scale/schedules but now the demo is done.
I don't want to pay for these services and I don't need them online for now. However, I don't want to have to recreate and reconfigure them if I need to relaunch the demo in a month.
Is there a way to save my current azure configurations to a file and then to be able to recreate all the services again automatically (with a script or a small program)?
Thanks!
This is a very good question, that sums up a historical problem we're in the process of making easier and more flexible. I'll answer this question with two parts.
First and foremost, you have tools like the PowerShell cmdlets now, that you can script out the creation of an entire "world" in Azure and then re-run whenever you want, against a subscription, to scaffold out a whole architecture. You can also use the management libraries for .NET to do this from a .NET application. When we embarked on the VS WebJobs tooling, for instance, I worked up a prototype for my developers on using MAML to create WebJobs and scheduler job collections. You can see the demo code for that here: https://github.com/bradygaster/maml-demo-scheduled-webjob-creator
We've also recently embarked on new mission of re-creating a lot of the management APIs so that they support the notion of templates and resource groups, to marry up with the new portal experience. Here's a great MSDN article that discusses how the PowerShell cmdlets for the Gallery could be used to pull down a list of the various templates that could then be pushed back up as fully-baked architectures running in Azure. You have the capability of building these templates yourself, then you could use these cmdlets to fan out and create things that you write up in your own custom templates. http://msdn.microsoft.com/en-us/library/dn654596.aspx
Hope this helps!
For Azure websites you can use the Back and Restore option to store the site and restore it back when you want to demo again, But all you have to do is Stop the services and you should be able to keep the demo without incurring cost.

create site in IIS with powershell

Working with an mvc4 application that runs in IIS 7.5, the site though exist once on disk, has over a 100 url's pointing to it. This is because the site displays content based on the country that needs to access it.
Due to this, the site can have over a 100 bindings, which is very hard to manage.
I am looking to automate the creating of the site in IIS using powershell. I would run this during each deployment to ensure each of my environments are identical (dev, qa, production).
The powershell script would delete the site and recreate it, applying bindings, configuring it etc. I am a newbie to powershell so I would appreciate any help with this.
You should be able to use the PowerShell IIS Administrative Cmdlets. I show how to automate creating and deleting web applications using them on my blog that should get you started.
I have a script I use when creating a website and AppPool in IIS 7+ (under .net4, Integrated pipeline, etc) and thought you might find it useful as its a bit simpler than some of the other answers. It will delete the site and replace it if it already exists making it good in continuous integration scenarios.
Use it as so:
CreateSite.ps1 [WebsiteName] [AppPoolName] [Port] [Path]
If you are reinstalling the site, you will need to stop it first. That is done as so:
StopSite.ps1 [WebsiteName] [AppPoolName]
you gan grab the scripts from my gist
There is an IIS provider for PowerShell which you can use to manage IIS from PowerShell.
Take a look at the available cmdlets.

Does VSTO run on Windows Azure?

I have a Web application which will be deployed to Windows Azure and I'm looking for alternatives to generate Excel spreadsheets.
Can I use VSTO to programatically generate an Excel spreadsheet in a Web Role running on Windows Azure?... If yes, how should I deploy the application to Windows Azure? What assemblies should I include?
Joni and Joe are correct. VSTO will not run on Azure.
I believe you're looking for the Open XML SDK. That lets you create Excel or other Office files from .NET without using Office automation.
Edit: Here's one option I have considered for those times when the Open XML SDK just doesn't have the functionality I can get from accessing an Office app's object model directly. Set up a machine outside of Azure that operates just as an Azure worker role would by processing messages from an Azure Queue. Since the app on that machine could be setup to execute tasks sequentially, you should be able to get away with things that wouldn't be advisable if you were trying to execute an Office app from a web role. This machine could be in your data center, or you could use an Azure VM so that you could install Office. If that VM was creating and/or reading Excel documents, then just use Azure Blob storage to store the documents.
If the machine running Office is outside of Azure, you will incur additional bandwidth costs for all the data coming in and out of Azure.
I tested this and apparently it won't work, VSTO requires Office to be installed.
I've been successful with generating Excel Spreadsheets in Azure using EPPlus open source project. It builds on the OpenXML SDK, but is much simpler to use.
I've been deploying the code to Worker Role instead of Web Role (as per Lokad.CQRS for Azure architecture) in order to pregenerate reports, so that the application would be more scalable. And the only required assembly was the Epplus.dll.

Resources