Showing posts with label Powershell. Show all posts
Showing posts with label Powershell. Show all posts

Thursday 7 September 2023

Extend Power Automate Logging

  1. Power Automate has a Connector to query other Power Automate environments to list, update flows,...
  2. PowerShell to examine Flow/Power automate

https://www.cloudsecuritea.com/2019/09/generate-an-overview-of-all-microsoft-flows-with-powershell/

Use postman to Interact with an API - get the bearer token first.

Saturday 17 September 2022

Generating a Canvas App from a Custom Connector (Open API)

Overview: The Power Platform CLI in August was updated and 1 of the new features is the ability to use the CLI command line to generate a Canvas app using an Open API as the data source.

The Power CLI supports the GET and POST endpoints.  Which is normally +85% of the endpoints anyway.  

In this post I walk thru the steps to add books using an Open API and retrieve all the books as well as the new book added.  

Solution

1. I used the free postman API endpoints (2 gets and a post) > Exported the collection

2. In Power Apps > using a Solution > Add a new Custom Connector (tip: I used Automate)> Upload from a Postman Collection > Pass in the Postman collection generated in the last step.   Save the Custom Connection as shown below.  Lastly test the Custom Connector.
3. I used Visual Studio code with the Power Platform Extension
Using the Power Platform CLI, in the terminal run ps> pac to verify the Power Platform extension is available.

// Get the environment you want to work on
ps> pac admin list

// Get the Custom Connector Name or Id you are going to base the Canvas app on
ps> pac connector list --environment a9adbbba-c45d-eac1

// Generate the msapp package
ps> pac canvas create --msapp "C:\Radimaging\BookDemo.msapp" --connector-display-name "BookDemoCN" --environment "a9adbbba-c45d"


4. Import the export Power App.  Select your environment, and create a new Canvas driven Power App.  "Open" has recently changed in the UI.


The app will get created, I had to add the Custom Connector to the App and you are ready to customise

Beware: Custom Connectors and Connection References in Managed Solutions.  It's a good idea to check they work in the deployment pipelines as the rework can be a pain.  

Summary: This is a great way to build an application quickly using the pac create.  It is a bit rough, and needs amending after import on the 3 endpoints I've used but a great start to a new feature. 

Sunday 17 June 2018

Azure Powershell from VS Code

Overview:  I am moving over to using Visual Studio code for everything including PowerShell.  Historically, I would use PowerGUI as it was the best IDE for PS for many years but PS ISE is excellent and I don't see a material difference these days.  Basically, I use VS code for my ISE for JS, SPFx, C# unless the full versions of Visual Studio speed up my delivery rate, this allows me to remain in VS code without going to PowerGUI or 1 of the Windows PS consoles/IDE.

Get the VS code debugger working: 

Get the IDE (VS Code) ready
On a new VS Code install, add the VS Extension "PowerShell", the VSIX has the description "Develop PowerShell scripts in Visual Studio Code!"



Run and Verify PS is working and output returned is working

Add the Azure Account Extension
Sign into Azure
A notification pops up to authenticate the machine/laptop with you Miscrofot credentials.  Run the popup and sign in to authenticate the local dev IDE.

 Open the Cloud Shell
Verify you are signed in



Thursday 18 January 2018

TLS Issue - The underlying connection was closed

Problem:  I have a console using CSOM that stopped working when the TLS settings were updated firm-wide.  The communication is between the console and a SharePoint farm, using CSOM, and now it no longer works.  The event log generates the following error message on the client machine: A fatal error occurred while creating an SSL client credential. The internal error state is 10013.

Initial Hypothesis: The outbound HTTPS traffic is the issue as the error is telling me that the mistake was creating the SSL client credential.  The console runs on a web server, and the TLS restriction change has caused the issue.  This issue is that the console running can't create an SSL client credential.  The TLS change was made to the console VM and not the SharePoint farm.  Here is the PS script to validate TLS versions written by Vadims Podans.


The post below helped me query the windows web servers to check the TLS settings using PowerShell.  I believe the outbound is controlled by the inbound TLS settings.

Resolution:  Change the console to use a know TLS version e.g., TLS1.2 as shown below:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

Alternatively, revert the TLS setting in the registry. Apparently, this means your server is more susceptible to attack.

Alternatively, specify all the portocols you support from the calling client side application ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;

Read this section if you are still having issues.
Factors that Influence Settings:
My CSOM console sits on a VM that hosts IIS, so there are three components to ensure connectivity excluding networking:
1.> SharePoint Server needs to support the TLS version
2.> VM hosting my console's outbound SSL is also set by IIS local TLS settings, so if I want to speak on TLS to the SharePoint server, I also need to have SSL enabled (or registry hacked) on TLS1.2 on the IIS VM hosting my console.
3.> My Console needs to support TLS 1.2 or all versions so it can negotiate for itself.  Regedit to check TLS setting is shown below:
More Info:
https://www.sysadmins.lv/blog-en/test-web-server-ssltls-protocol-support-with-powershell.aspx

Also look at this post to enforce TLS1.2

HKEY_LOCAL_MACHINE\SOFTWARE\\Microsoft\.NETFramework\\v4.0.30319

   SchUseStrongCrypto = (DWORD): 00000001
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\\.NETFramework\\v4.0.30319
       SchUseStrongCrypto = (DWORD): 00000001


Sunday 6 December 2015

Smoke Testing SharePoint using Selenium IDE

Overview:  In SharePoint we need to retest code often as we make incremental changes.  Basic smoke testing is useful in that is allows you a certain degree of confidence that a bug has not crept into your latest deployment.

Most projects have varying degrees of control to ensure bugs do not cause unexpected behaviour and on the more advanced practices is unit testing and coded UI tests.  The unit tests are tricky with all the new SharePoint development methods.  Jasmine is a JavaScript testing framework and check out the @SPDoctor (Bill) for basic testing information.  Unit testing SP is difficult as the revs end up test SP and not the changes.  A lot of the code is UI driven which is hard to unit test.  I have previously written about code UI testing, MTM as part of the MS test and continuous testing.  And part of this is Selenium WebDriver.  I've used it once on a large project and it was awesome.  Now as you go into production you normally will do some manual smoke testing to check the deployment.

This post looks at automating smoke test.

There are various tools for recording smoke test or you can do the manual eyeball approach favoured my most SP project still.  I have used Powershell (both to gen http requests and to control IE).  MTM is good but it requires buy into the whole MTM process.  Personally I like Selenium IDE for Firefox.  It offers recording, and the capturing functionality is miles ahead of anything else.  These Selenium generate test can be export and used with Visual Studio or build into TFS or on a project I used TeamCity to run automated continuous build and integration.

Note:  Selenium IDE is the recording piece and Selenium WebDriver is the heavy duty real testing integration part.

Get Started:
1. Download Selenium IDE (make sure you get the Selenium IDE, I'm using version 2.9.0) 
2. Understand the UI and capabilities (YouTube basic Selenium IDE videos are great)
3. Install Selenium IDE on Firefox as shown below:




























4. Launch Selenium IDE using FireFox








5. Record and run Selenium test (2 minute short video providing a Selenium IDE recorded test against a SharePoint Online Team Site).

Another option is to control IE using PowerShell
PS> $ie=New-Object -com internetexplorer.application  #open ie
PS> $ie.Navigate("http://www.radimaging.co.uk/Pages/default.aspx")


Saturday 25 April 2015

DevOps Tooling

DevOps Tooling Notes

DevOps Tooling is broken down into the following areas, note the tools often overlap in function.  The list is not exhaustive but these are the more common tools I have come across.
  1. Version Control: TFS, Git, SVN, ...
  2. Bug Tracking: ServiceNow, Jira, ZenDesk
  3. Continuous Testing: Selenium, Jasmin or Mocha or Unit.js (JavaScript testing), NUnit, Web Tests (Visual Studio), SpecFlow
  4. Continuous Integration (CI)TeamCity, Jenkins, Azure DevOps (bigger) 
  5. Configuration Management and Deployment:  Puppet, Chef, ANSIBLE, SALT  (all installed on Linux, obviously work on Windows environments)
  6. Containers: Docker, Kubernetes, Microsoft Containers. I think the Azure AKS is pretty much containers for Azure now.
  7. Other:  PowerShell, VMWare, HyperV
RESTful API Tooling
  1. Swagger - awesome.  Swagger is a set of tools that help document, build and test your API  (Your API conforms to the OpenAPI specification or Swagger specification).  Great way to get a contract for users of the API early on.  Updated 2019/11/25Link to Swagger post
  2. Swagger UI, Swagger Integrator,...
  3. Apiary - UI to create an API and publish with mocks.  I prefer Swagger or on simple projects APIM.
  4. API Management (APIM) - flexible Azure service for bring together multiple API securely.  Same as MuleSoft.  Can import OpenAPI's v2 or v3 to create a hosted API.  Can mock and built in test tool.
  5. RAML is an alternative to Swagger and Apiary (never used)
  6. Blueprint - API documentation tool.  Pretty simple and nice results.
  7. Postman - send http requests to the API.  Postman is a REST client useful to check your API.  This is my main tool for testing, exploring REST based API's.  
  8. SoapUI - if working with SOAP/XML.
  9. Slate - API documentation - I always use OAS/OpenAPI/Swagger.
  10. Fiddler - I'm old school and still love Fiddler and it's capabilities.  Fiddler is a great HTTP debugger.  
  11. BURP - an HTTP debugger to review traffic.  I've used BURP for security testing and it is great for API debugging.  
  12. Charles is another HTTP debugger (never used).
  13. cURL - Cmd line to test API's using HTTP, separate exe to run on Windows, Windows 10 has cURL built in.
  14. Visual Studio
  15. Wireshark - Over the years I have needed packet sniffing to fix issues and always go to Wireshark, I used the tool in the 90's but it had a different name.  Extremely useful for issues relating to firewalls, especially when an environment reacts differently to another working DTAP environment.
  16. Tcpdump is another packet sniffer
Testing:
http://www.incyclesoftware.com/2014/02/executing-selenium-ui-tests-release-management/

More Info:
http://blog.sharepointsite.co.uk/2014/02/devops-and-sharepoint.html
http://www.networkworld.com/article/2172097/virtualization/puppet-vs--chef-vs--ansible-vs--salt.html
http://blog.sharepointsite.co.uk/2013/11/iac-presentation-for-sharepoint.html


Sunday 6 April 2014

Writing SharePoint PowerShell Modules or snap-ins

A module is a self-contained set of code that once loaded can be called/used.  I use modules to keep similar SharePoint functionality that I want to reuse.  There are 2 basic types of modules:
1.> Script modules, this is the easiest and most common type of module.  Take you .ps1 file and rename it .psm1
2.> Code/Binary modules are compiled dll's that can be loaded and used.  You can also create a snap-in with binary code.
3> Snap-ins, are compiled code dll's.  The snap-ins can be loaded and used within your PS console.


Snap-ins are not code modules.  I prefer to keep my files as ps1 files and load them in a controlling .ps1 files before using them or if I need to write code that uses the CSOM I would use C# and create a snap-in that I can port and consume.


More Info:
http://zimmergren.net/technical/sp-2010-how-to-create-a-powershell-snapin-part-1
http://www.wrox.com/WileyCDA/Section/Extending-Windows-Powershell-with-Snap-ins.id-320555.html



Sunday 23 February 2014

SharePoint Online Random Tips

1.> SPO and PowerShell:
To connect and use SharePoint online you cannot have a small business plan (P).  The Medium and enterprise Office 365 plans allow the SPO PowerShell scripts to run (very few so far).
Steps to use PS against SPO:
1.1.> Download and install the SharePoint Online Management Plugin
 1.2.> Add the snap-in/module to your PowerShell (or use the console with the snap-in already loaded)
 1.3.> Connect to your SharePoint site and validate it works.

=============================================================

2.> OOTB SPO Workflows:
P Plan only has three state workflow
E Plan has 5 basic workflows: signature, 3 state, approval, ..

Sandbox does not support Visual Studio based (code) workflows but you can create declaritive workflows via SPD.

SharePoint 365 Workflow Creation Process:
  • Prototype in Visio 2010 by using the SharePoint specific workflow, this can be demonstrated with the end user as they understand Visio workflow diagrams to explain there business process.
  • Export Visio 2010 diagram to SPD
  • Implement the workflow using SPD can integrate InfoPath forms
  • Custom actions are created using VS and can be deployed, the custom actions can be integrated into the SPD created workflow.
=============================================================

Thursday 2 January 2014

IIS setting for SharePoint 2013

Some checks and reminders for IIS - This is a work in progress!

1.> Change the IIS log location for existing websites, this needs to be done on each WFE in your farm, providing you want to change them. 
PS Script to Change the IIS log directory for existing web sites.
2.> Disable IIS recycling
3.> Ensure app pool accounts have low levels of network permissions.
4.> Certificates used by IIS, when do they expire.
5.> Application Initialisation for IIS8 or warm-up scripts to stop the long delays after and IISREST/app pool recycle.

   **************
CPU over utilisation


   ********************

Verify when certificates are going to expire:

import-module webadministration
$DaysToExpiration = 365
#change this once it's working
$expirationDate = (Get-Date).AddDays($DaysToExpiration)
$expirationDate5yrs = (Get-Date).AddDays(1020)
$certs = Get-ChildItem IIS:SSLBindings
foreach($cert in $certs)
{
 $store = $cert.Store.ToString()
 Write-Host " Cert Store:" $cert.Store.ToString()
 Write-Host " Cert Port:" $cert.Port.ToString()
 Write-Host " Cert Thumbprint:" $cert.Thumbprint
  $body = Get-ChildItem CERT:LocalMachine/$store
  foreach ($me in $body) {

   if ($expirationDate -gt $me.NotAfter) {
    Write-Host " Expiring soon" -BackgroundColor red
   }
   elseif ($expirationDate5yrs -gt $me.NotAfter) {
    Write-Host " Expiring in 5 years" -BackgroundColor Yellow
   }
   elseif ($expirationDate -le $me.NotAfter) {
    Write-Host " Expiring more than a year away" -BackgroundColor green
   }
   Write-Host " - Body subject: " $me.Subject
   Write-Host " - Body thumbprint: " $me.Thumbprint
   Write-Host " - Body fiendly name: "$me.FriendlyName
   Write-Host " - Body Expiry: "$me.NotAfter
  }
     Write-Host ""
}

 *********************
 Check the service account do not have too many permissions:
Script below retrieves pswd to show client potential issue

Import-Module WebAdministration
$webapps = Get-WebApplication
foreach ($webapp in get-childitem IIS:\AppPools\)
{
$iispath = "IIS:\AppPools\" + $webapp.name
$pswd = $webapp.processModel.password
$state = (Get-WebAppPoolState -Name $webapp.name).Value
$color = "White"
$forecolor = "Black"
if ($pswd.Length -gt 0)  {$color = "red"} # verify the domain accounts don't have excessive priviges
if ($state -eq "Stopped")  {$forecolor = "blue"} #Why are there stopped IIS websites
Write-Host "Name:" $webapp.name " | Version:" (Get-ItemProperty $iispath managedRuntimeVersion).Value `
" | Username:" $webapp.processModel.userName " | Pswd:" $pswd `
" | State:" $state -BackgroundColor $color -ForegroundColor $forecolor
}

 Tip: Advise client to change Windows service account used to run the SP timer job.  Check ramifications.


**********************************

Monday 4 November 2013

PowerShell Tools for Visual Studio

Problem:  I like PowerGUI for my PowerShell IDE but I want to be able to work with my PS files with source control (TFS). 

Initial Hypothesis:  Ideally I want Visual studio to work like PowerGui namely, providing line count, local variables, debugging, colour coding and intelesense.

Resolution:
PowerGui has a plug-in for Visual Studio but it only works on old versions of PowerGui.  I find it not worth the errort for the value the tool adds.

PowerShell Tools for Visual Studio is a VSIX plugin for Visual Studio that appears to meet all my requiremnts.

More Info:
http://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62-6eee37294597

Wednesday 20 March 2013

AlwaysOn Availability Groups SQL 2012

Overview:  SQL 2012 offers AlwaysON Availability Groups (AOAG)

Notes:
  • All SP2013 dbs support Synchronous Replication via AOAG.
  • Most SP2010 excludes Search, Profiles and Syn (I think).  SP2010 needs SP 1 to use SQL2012 features including AOAG.
  • Synchronous replication requires 1GB+ bandwidth and less than a 10ms latency
  • For AOAG you need Windows 2008 R2 Enterprise edition.  SQL 2012 Enterprise edition
  • Databases need to be in the Full Recovery Model to use AOAG
Download the PS to add databases to existing AG's.

AOAG only support databases that are set to use the "FULL" recovery model.  Multiple SharePoint database are set to use the "Simple" recovery model.  I haven't found anything saying MS will support switching all the databases to the "Full" recovery model.  Performance wise "Simple" runs faster but the benefit of having AOAG is generally worth the change to the recovery model.

Note: SP2010 has several databases that use a simple recovery model (Search, Profile, sync, usageandhealth dbs). 

Note: SP2010 has several databases that use a simple recovery model (4 Search dbs: Search, search_analytics, search_Crawl, search_linkstore.  5) Profile 6) Sync 7) Social 8) UsageandHealth).

Note: The listener and the cluster are created within AD and are added as Computers, this will only use the 1st 16 characters for adding the listen and the cluster, it cuts off the rest.  Make sure the listen and cluster are less than 17 chars.

Note: FS4SP I added the Administrators database for resilience.
FASTSearchAdministors (Full Recovery model) - AOAG works
FAST_ContentService (Simple)
FAST_ContentService_CrawlStore (Simple)
FAST_ContentService_PropertyStore (Simple)
FAST_QueryService (Simple)
FAST_QueryService_CrawlStore (Simple)
FAST_QueryService_PropertyStore (Simple)

Tip: I was performing backups that we corrupting my databases.  Before doing the backup and
Restore to perform the AOAG sync, delete the old backups.

References:
http://www.slideshare.net/michaeltnoel/sql-2012-alwayson-availability-groups-for-sharepoint-2013-sharepoint-connections-amsterdam-2012
http://technet.microsoft.com/en-gb/library/jj715261.aspx
http://blogs.msdn.com/b/sambetts/archive/2013/04/24/sharepoint-2013-and-sql-server-alwayson-high-availability-sharepoint.aspx

"No need for Aliases..".  Aliase have 2 purposes:
1) the database goes down, you get pointed to the alternative database.  AOAG listener does the exact same function so I agree that there is no point in using an alaise for failover.
2) SQL Alaises allow you to split up which database you are working with.  So by having let's say a single AOAG with 2 aliases that point to the same AOAG listener is perfect as later you can move the Search databaases to another AOAG instance and you don't need to re-run the config wizard. 

Minor point but I'd still use aliases on top of AOAG listeners.

The script below runs thru the databases on the 1 server in the AOAG and if they are set to use the "Simple" Recovery Model, it changes the SQL Recovery Model to "FULL".  In my case I have used AutoSPInstaller to build my SP2013 farm.  This has prefixed all my databases with AutoSP_, this allows me to make sure I am only targeting SP database for my change to the recovery model (See line 11).
 

Monday 18 March 2013

PowerShell SharePoint web site Warm-up Script

Overview: Useful PowerShell Script to check when a SharePoint website is up and running, I use this a a trigger in my build process.  It can also be used as a warm up script for demo's.

Download SharePoint Warmup script.
Another Nice SP Warmup script for SharePoint.

For public websites you can also use a monitoring service to ensure your website is constantly warm such as AlertFox.

Another Script:
http://www.justinkobel.com/post/2013/08/16/My-SharePoint-2013-(and-2010)-Warm-up-Script.aspx

Wednesday 13 February 2013

Reboot and Resume and RunOnce PowerShell Script

Overview:  It is fairly common to need a reboot and you want to automatically run some PowerShell once the server is back up.

This package contains 2 PS 1 files (download):
  • Restart-VM.ps1 (Contains all the code to reboot the server and lainch the function from here)
  • Restart-VM-Custom.ps1  (2 functions to add your custom logic.  You can add either to the Pre-shut down code to execute or the PS to run once the server has restarted)
Steps
  1. Extract both PS1 files into the same folder on your machine;
  2. Edit the file "Restart-VM-Custom.ps1", noteably create your custom scripting logic within the "CustomRestartActions" function; and
  3. Run "Restart-VM.ps1" as the administrator.
PS to reboot remote machines:
PS> Restart-Computer -computer 192.168.1.2 -force

RunOnce Example (Download)

1 PS files: 
1st file changes the registry to autologgon and run the runonce.


2nd ps file creates a folder, removes the autologin and reboots

Remote RunOnce using PS, useful for remote builds (Download)

Run on build server to setup RunOnce on the remote server
 Run on the target Remote Machine


Remote PS using Invoke-Remote
 
Updated 10 June 2013: I am using a REG_EXPAND_SZ Registry key type and I have discovered that the value needs to be less than 255 characters.  Mine was 270 odd characters as it had multiple attributes.  E.g.
RunOnce>c:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -command " .'C:\Windows\Temp\SQLInstall\Start-ServerCustomisation-SQL-All.ps1' 'k:\SQLInstallerInput-Test.xml' 'k:\\192.168.1.199\c$\LocationNotingDeployment\vSphere\Test /user:xxxxxxxxxxxxxxxxxxxxxxx P@aassssss'"</RunOnce>

My runonce was not firing, however the RunOnce registry key was saved correctly (270 chars).  The command could be executed from the cmd prompt with the longer length but to automate the Reg-Expand_SZ key value needs to be less than 255 characters long.

Friday 1 February 2013

PS functionality - logging, xml, local permissions, remote PS

Read config values from an xml file - download zipped files

Download contains:
PS-Logging.Ps1 - Allows for an optional paramter to set the XML file to read from. Of the input xml is not valid or specified revert to reading a predefined xml file from the same location in the directory that PS-logging.PS1 is saved to.
PS-LoggingMore.Ps1 - Easy way to log the PowerShell consoles actions. As it doesn't work with PowerGui, it will check the IDE.
AutoInput.xml - Is an xml files that is used for configuration of these examples.
PS-Logging.png - describes the workings of the files (ignore).

Other:
Import External Functions (download) - ability to write separate PS files and call the functions within from the main/starting PS file.

Specifying Input Parameters Strict Example:
param(
[Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()]
$configLocation
)

**************************************************

Ability to Execute PS on a remote trusted computer

The PS below has 2 simple functions to illustrate:
  • running a remote PS commands (tip, ensure the PS window is running using a network account that has administrator rights on the 2 remote servers) and
  • adding a domain user account or AD group to the local machine administrators group.


Invoke-Command -computername sp-srch1, sp-srch2 -command {
 $computer = [ADSI]("WinNT://" + $env:COMPUTERNAME + ",computer")
 $Group = $computer.psbase.children.find("administrators")
 $acc = "demo/sp_searchservice"
 $Group.Add("WinNT://" + $acc)
 Restart-Service -Name SPSearchHostController  # Restart the windows service
 Restart-Service -Name OSearch15
}

Sunday 9 December 2012

Setting up VMs (VMware ESX5)


Overview:  VMware ESXi is a 1st class virtualisation platform and commonly used to host SharePoint VM's.  The post looks at the common tools for managing/setting up my VMware based infrastructure.  I'm certainly not an expert in virtualisation but this is a 101 in setting up VM's.
 
vSphere Client connects to the ESXi server infrastructure and provides a UI management tool.
 
PowerShell with PowerCLI to let you manage your ESX infrastructure using PowerShell. 
My preferred option is to use PowerGUI and user the add the PowerCli add in so I can interact with ESX but I have Intellisense and nice debugging capabilities.   The snippet below shows how to connect to the ESXi server.
Script expanded with more detail.  Really need to loop throu config to create multiple VM's and get their individual settings.
Before running the script ensure you have the OSCustomizationSpec and OS template as you need them to build.
Check the VM is created.
Summary:  Useful scripts for building a unique set of VM's on VMware.  For Continuous Integration it is better to start with pre-build environments.  My next step would be to fire off the SQL Server 2012 builds on 1 or more of these VM's as shown in the SQL Server 2012 slipstreamed install.

Thanks to Wayne Senior for info in this post.

Monday 28 May 2012

PS for Office 365

http://onlinehelp.microsoft.com/office365-enterprises/hh124998.aspx
http://technet.microsoft.com/en-us/magazine/hh750396.aspx
http://blog.powershell.no/2011/05/09/administering-microsoft-office-365-using-windows-powershell/

Rene Modery gave me some useful information on Office 365 namely you can manage Exchange Online but not SPO using remote PS. 

You can also use PS to manage information around accounts for Office365 which in effect is used by SPO.

Saturday 24 March 2012

Turning on the Windows 2008 R2 Desktop Experience

Problem: A standalone developer VM generally means that the developer needs to use the browser on the Windows 2008 Server to check features are working in SharePoint.  On such problem with working on the Windows 2008 desktop you can't open a document library in Windows Explorer.
Error Message: "Your client does not support opening this list with Windows Explorer.".
Your client does not support opening this list with Windows Explorer
Initial Hypothesis:
Turn on the Windows Desktop Experience feature.
Windows feature - turn on 'Desktop Experience'
Resolution:
Run the following 2 PS cmds as administrator:
PS> Import-Module Servermanager

PS> Add-WindowsFeature Desktop-Experience -restart


Note: I only apply this to me development machines.

The Desktop Experience also fixes using Office on the Dev VM.
Useful PS cmds in this area:
# Import-Module Servermanager

# Get-WindowsFeature
# See what Windows features is installed
# Add-WindowsFeature Desktop-Experience -restart
# Remove-WindowsFeature Desktop-Experience -restart

Saturday 25 February 2012

Quick Way to Verify your Build

Problem: Going to a new client you need to work out each of their enviroments, this can be done using CA, PowerShell and T-SQL.

Inital Hypothesis:  Create a PowerShell script that crawls and maps the farm, and outputs the results.  This should examine all the WFE and application servers and the SQL Servers.  If should report on the OS, SQL Server and SharePoint. 

Resolution:  Until someone builds a better flushed out script, I am looking at the local instance of SQL (default) and the SharePoint farm.  This script has been tested to run on a full standalone machine containing both SQL Server and SP2010.
Additional work could be done to crawl all servers in the farm and output the results.  As BGInfo gives the local admin all the network and OS data, this script does it for the application software.

Additional work to do to this script is to loop thru all the SQL instances remotely, display a report or even generate a nice diagram and potentially change the background screen save with all the information on the server containing Central Admin.

In the screen shot above: SQL Server build versions 10.50.2500.0 is SQL Server 2008 R2 SP1; SP2010 build version 14.0.6109.5002  is CU August 2011.
GetSPInfo.ps download.



Updated: 19 July 2012 - Add the line tot he script to show SQL 2012 under the version:
11 {[string]$SqlInfo.SQL_Version = "SQL Server 2012"}

Updated: 24/02/2012 - I had problem in UAT where I was getting stange behaviour and I releaised somebody had changed the time on one of 10 SharePoint servers causing me problems.  The script below verifies the TimeZone for servers in your farm. 
 
 
More Info:
SP2010 build number by Dave Coleman.

Sunday 12 February 2012

Checking the Sandbox solutions settings using Powershell

Display the sandboxed solutions service configuration settings:


$uc=[Microsoft.SharePoint.Administration.SPUserCodeService]::Local

foreach($tier in $uc.Tiers)
{
Write-Host "Tier Name: $($tier.Name)"
Write-Host "Tier MaximumWorkerProcess: $($tier.MaximumWorkerProcesses)"
Write-Host "Tier MaximumConnectionsPerProcess: $($tier.MaximumConnectionsPerProcess)"
Write-Host "Tier MaximumAppDomainsPerProcess: $($tier.MaximumAppDomainsPerProcess)"
Write-Host "Tier PriorityPerProcess: $($tier.PriorityPerProcess)"
Write-Host "Tier ResourceMaxValue: $($tier.ResourceMaxValue)"
}
 
Reference: http://technet.microsoft.com/en-us/library/hh230317.aspx

Thursday 28 July 2011

Remote Builds using PS

Enable Powershell Remoting
=====================
Login to each server that needs to run PS scripts, this will allow centralised deployment of PS Scripts.