Powershell One Liners
Friday, 17 July 2020
Thursday, 4 June 2020
Remove Unique Permissions
Remove Unique Permissions
Long ago, it was a common requirement for a client to add unique permission for SharePoint files or list items.
Can you guess the function that adds unique permission?
BreakRoleIneritance
However, it decreased the performance and that can be a very bad choice.
Below is a tool I did that removes the unique permissions for a SharePoint library in a SharePoint site for Online version.
Demo
Tool Link:
https://payhip.com/b/GgQO
If you want the above tool for a discount price, apply the code
6307EIT6ZW
Please make sure you test on a test library before running on production.
If you have many such requests, you may contact for a free trail run of one PowerShell script on your environment by submitting a request on
https://forms.office.com/Pages/ResponsePage.aspx?id=VeQH6wiZhkyj0EhqSzeQ2AF7ASEEeOpCqBFwiSc3gXVUM09GTTJEODQ5UTVLOUJFRkZFTUdYRVhXOC4u
If you need similar request for another version of SharePoint, please contact on www.thangu.com
Wednesday, 22 April 2020
How to create a certificate for EXE on Windows 10
Steps:
1. Download the Windows 10 SDK
https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk/
2. Open Command Prompt CMD as Administrator
Go to the folder with Sign Tool
C:\Program Files (x86)\Windows Kits\10\App Certification Kit
signtool sign /a MyFile.exe TO get a valid certificate try the link https://www.certum.eu/en/cert_offer_en_open_source_cs/
1. Download the Windows 10 SDK
https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk/
2. Open Command Prompt CMD as Administrator
Go to the folder with Sign Tool
C:\Program Files (x86)\Windows Kits\10\App Certification Kit
signtool sign /a MyFile.exe TO get a valid certificate try the link https://www.certum.eu/en/cert_offer_en_open_source_cs/
Thursday, 27 February 2020
Get Windows Details
Get Windows Details
Below is a short script to get Windows Edition
$windowsDetails=Get-WmiObject -Class Win32_OperatingSystem |select Caption
If you are interested in more Windows related commands, see here
If you are interested in more Windows related commands, see here
Here is a sample video of the script that allows you to display the report as shown below:
You can access the running tool from here:
If you have a custom requirement like this, mention in the comment box and I will try to update the scripts to your custom requirement when I am free.
If you have any other custom report requirements for other objects like Office 365,SharePoint, SQL or any other System, you may contact https://calendly.com/spthangu for Professional consulting for small requirements that take 5mins to 1 hour max for a small charge of 10$-50$.
Thursday, 12 September 2019
PowerShell Here String
Here String
This is a short blog on Here String. I decided to write down about this since I wanted to share the experiences with PowerShell features, that I heavily use.
I commonly use the following type of code to store large strings in a variable.
$data=@"
{
"@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/$($userID)"
}
"@
{
"@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/$($userID)"
}
"@
Why do I use the above instead of using a normal string?
$data="{
"@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/$($userID)"
}"
"@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/$($userID)"
}"
Reasons:
1.The above code throws error due to the presence of string with double quotes
2. Using back ` is terrible for strings with many double quotes .
What was I doing to allow double quotes and have large strings declared in a variable?
I used @ at the end and beginning of the string and the string was able to store large data.
I did not know that the term used for this feature was Here string until I read various msdn blogs on PowerShell and came to know the Here String term.
What is Here String?
A simple String that allows you to declare multi ling string along with Quotes and variable values.
Make sure that you have a line break after the first @", else the following command throws error:
$HereString=@"My
"life"
is
in
my hands"@
"life"
is
in
my hands"@
The following code works correctly
$when="Always"
$HereString=@"
My
"life"
is
in
my hands $when
"@
$HereString=@"
My
"life"
is
in
my hands $when
"@
Below the output:
My
"life"
is
in
my hands Always
"life"
is
in
my hands Always
Saturday, 22 December 2018
Office 365 and PowerShell Mails
PowerShell and Office 365
Office 365 is a great product and there are nice ways to manage them with PowerShell itself.
Lets get started by connecting.
#Connect to Exchange
#Set-ExecutionPolicy RemoteSigned
#https://docs.microsoft.com/en-us/powershell/exchange/exchange-online/connect-to-exchange-online-powershell/connect-to-exchange-online-powershell?view=exchange-ps
$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
#Set-ExecutionPolicy RemoteSigned
#https://docs.microsoft.com/en-us/powershell/exchange/exchange-online/connect-to-exchange-online-powershell/connect-to-exchange-online-powershell?view=exchange-ps
$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
Once, you connect, see the Mailbox
Get-Mailbox
I
Friday, 14 December 2018
Subscribe to:
Comments (Atom)