SharePoint – Difference between Item level Permission and Item level Security

December 1, 2017

Recently I discovered that in SharePoint there is a difference between Item Level Security and Item Level Permissions.

1. Item level Security

This is the one everyone knows…

You can set user security on each individual doc. in a library or a record in a list.


2. Item Level Permission

For Document libraries you can only modify this using PowerShell (or .NET)

In my opinion this has less performance impact than the Item level Security.

But of course it serves a different purpose too…

So depending on what you need I would definitely consider this option.

Here are the different options :

https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.writesecurity.aspx

SPList.WriteSecurity
•    1 = All users can modify all items.
•    2 = Users can modify only items that they create.
•    4 = Users cannot modify any list item.

https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.readsecurity.aspx

SPList.ReadSecurity
•    1 = All users have Read access to all items.
•    2 = Users have Read access only to items that they create.

Example :

CLS

if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null)
{
	Add-PSSnapin Microsoft.SharePoint.PowerShell;
}

$web = Get-SPWeb -Identity http://YourSP

$list = $web.Lists["Documents"]

"Read Security = " +  $list.ReadSecurity 
"Write Security = " + $list.WriteSecurity


For SharePoint lists you can just use the GUI :

image

Enjoy !

Advertisements

PowerShell – Azure Cloud Shell for PowerShell and Bash

November 3, 2017

Microsoft recently released a new feature called Azure Cloud Shell (for PowerShell and Bash).

To get started you need to log into the Azure Portal.

1. Click this icon

image

2. Choose Bash or PowerShell

image

3. Subscribe

This wil create an Azure File Storage to store your scripts

image

File Storage

Azure Files offers fully managed file shares in the cloud that are accessible via the industry standard Server Message Block (SMB) protocol.

Azure File shares can be mounted concurrently by cloud or on-premises deployments of Windows, macOS, and Linux.

Azure Files enable sharing files between applications running in your virtual machines using familiar Windows APIs or File REST API. Additionally,

Azure File Sync allows caching and synchronization of Azure Files shares on Windows Servers for local access.

image

Once created you can access all Azure resource using PowerShell or Bash resources.

And the scripts will be available online using your PC or even on a Mobile device !


image


Read more here : https://docs.microsoft.com/en-us/azure/cloud-shell/overview

Or watch this movie https://www.youtube.com/watch?v=RhnZ4lJgEnU&MC=SysMagSof&MC=MSAzure

Enjoy!


PowerShell – Using PoSH SSH Module to access Synology NAS

October 21, 2017

You can now access any SSH device using the PoSH SSH module.

Let’s give it a try using a Synology NAS Device.

Make sure that you enable the SSH Access Service

image

Next make sure you have installed the PoSH-SSH module

Find-Module Posh-SSH

image

Next install it using this command (run as Administrator) :

Find-Module Posh-SSH | Install-Module

After installing you can check the commands available

Get-Command -Module Posh-SSH

image

Now you are ready to make a connection Smile

New-SSHSession -ComputerName YourNASDeviceNAME

image

You can check the session info like this

Get-SSHSession
Get-SSHTrustedHost | fl

image

Let’s run some commands

Invoke-SSHCommand -SessionId 0 -Command "ls -all" | select-Object output -expandproperty output | fl

image

Or using this format :

$result = Invoke-SSHCommand -Index 0 -Command "uname -a; cd /; pwd; ls /volume1" 
$result.Output

image

$result = Invoke-SSHCommand -Index 0 -Command "uname -a" 
$result.Output

image

To stop the session use this command :

Remove-SSHSession -Index 0 -Verbose

image

Enjoy !!


PowerShell – Database Choise SQLite vs SQLCE

October 12, 2017

 

Over time I wrote some posts relating to SQLCE as a nice standalone Database platform that can by used in PowerShell or Webmatrix on IIS etc.

Now that MS has announced the end of life of Webmatrix Sad smile

“WebMatrix product support ends on November 1st, 2017”

As Webmatrix runs on MSSQLCE we need to look for alternatives…

“MS SQLCE support will end in July 2021”

One of the most obvious alternative is of course SQLite, which is shipped as part of AutoIT Winking smile

 

Besides this, SQLite has much more to offer then SQLCE :

Comparison http://erikej.blogspot.be/2011/01/comparison-of-sql-server-compact-4-and.html

 

As you can see the size limit is 140 TB and unlimited concurrent users !

And it runs on Windows / Linux / Mac … and as well on Mobile devices.

So this will do for a while … Winking smile

 

SOLUTION :

1. Download the appropriate .NET Assembly for your environment

https://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki

2. Run this PS code :

Add-Type -Path "C:\Temp\.NET SQLite Library\System.Data.SQLite.dll" 

$con = New-Object -TypeName System.Data.SQLite.SQLiteConnection
$con.ConnectionString = "Data Source=C:\Temp\.NET SQLite Library\northwindEF.db"

$con.Open()

$sql = $con.CreateCommand()
$sql.CommandText = "SELECT * FROM Customers"
$adapter = New-Object -TypeName System.Data.SQLite.SQLiteDataAdapter $sql
$data = New-Object System.Data.DataSet

[void]$adapter.Fill($data)

"Rows # :  " + $data.tables.rows.count
$data.tables.rows | Out-GridView # | ft

3. Test it.

Once you run it you can access the SQLite Database lightning fast …

 

image

 

Some more Tips and Tools you can find here :

http://erikej.blogspot.be/2014/08/sqlite-toolbox-40-visual-guide-of.html

http://erikej.blogspot.be/2014/11/using-sqlite-with-entity-framework-6.html

Enjoy !


PowerShell – Import-Pssession is not Importing Cmdlets for O365 Exchange Online

August 30, 2017

 

I noticed that after connecting to O365 Exchange Online using PowerShell, the connection was done OK.

But I could recognize any of the Cmdlets after connecting Sad smile

 

SOLUTION :

$LiveCred = Get-Credential -credential "patrick.taels@plastiflex.com"
   $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-Module (Import-PSSession $Session -WarningAction SilentlyContinue -AllowClobber) -Global 

 

As you can notice you need to add the Import-Module( … –AllowClobber) –Global Command and Parameters …

Enjoy !


AutoIT – Meets PowerShell using .NET Common Language Runtime (CLR) Framework

August 9, 2017

Since we AutoIT have got access the to the .NET Common Language Runtime (CLR) Framework 

We can access the PowerShell Automation Classes as well.

This is really powerfull stuff … because we can reuse .NET code as well as all the native CMDlet’s and scripts.

As you can see the script runs an PowerShell command that lists all running processes on your machine. And return the Output to a .NET Grid.

image

Which runs inside our Unmanaged Host, isn’t that cool …Smile

We can access native .NET Classes as well because PS runs on top off it.

Next is that you could access any kind of Cloud Web Service using the multitude of PS Modules that are available.

As well as accessing Custom Build Assemblies.

How to :

For more information on how to access .NET Classes see the above post about .NET Common Language CLR Framework.

Or Join the most friendly and helpful AutoIT Community on the net Smile

I will post some more examples and How To’s later on, so stay tuned …


PowerShell – Download Module from Gallery

May 3, 2017

Option 1 :

Use a system that has a PS 5.0 or higher and save it there.

Copy it over and install it on a PS 3.0 or 4.0 version.

Inspect

PS> Save-Module -Name SqlServer -Path <path>

Install

PS> Install-Module -Name SqlServer

clip_image002

Option 2 :

Install the GUI : PackageManagement PowerShell Modules Preview – March 2016

https://www.microsoft.com/en-us/download/details.aspx?id=51451

clip_image004