header image

Archive for May, 2014

Modifying the Add-SharePermission function to enable the application of Deny permissions is a simple matter of adding a switch parameter –deny  and modifying the way the AcreType is set: #requires -Version 3.0 function Add-SharePermission { [CmdletBinding()] param (   [Parameter(Mandatory=$true)]   [string]$sharename,   [string]$domain = $env:COMPUTERNAME,   [Parameter(Mandatory=$true)]   [string]$trusteeName,   [Parameter(Mandatory=$true)]   [ValidateSet("Read", "Change", […]

under: PowerShell and CIM, PowerShell and WMI, PowerShell V3, PowerShell v4

Permissions can be set to either allow access ot to deny access.  The functions I’ve presented so far only work with Allow permissions. Using Deny permissions should be avoided if at all possible but sometimes there’s no alternative. First thing is to modify Get-SharePermission so that it shows if the permission is allowed or denied. […]

under: PowerShell and CIM, PowerShell and WMI, PowerShell V3, PowerShell v4

How many times have you done this: £> Get-ADComputer -Identity "bleh" Get-ADComputer : Cannot find an object with identity: ‘bleh’ under: ‘DC=Manticore,DC=org’. At line:1 char:1 + Get-ADComputer -Identity "bleh" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : ObjectNotFound: (bleh:ADComputer) [Get-ADComputer], ADIdentityNotFoundException     + FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException, Microsoft.ActiveDirectory.Management.Commands.GetADComputer Its the same with all of the AD cmdlets – […]

under: PowerShell and Active Directory, PowerShell Basics

So far you’ve seen how to read, remove and add permissions to a share.  The final scenario to be covered is modifying a permission. The functions I’ve presented to date only enable you to set Allow permissions on a share. I’ll be covering Deny permissions in later posts. This mimics the way that I tend […]

under: PowerShell and CIM, PowerShell and WMI, PowerShell V3, PowerShell v4

You’ve seen how to read share permissions and how to add share permissions – now its time to remove share permissions.  Most of the code we need is in the Add-Sharepermission function – it just needs a bit of a tweak. #requires -Version 3.0 function Remove-SharePermission { [CmdletBinding()] param (   [Parameter(Mandatory=$true)]   [string]$sharename,   […]

under: PowerShell and CIM, PowerShell and WMI, PowerShell V3, PowerShell v4

Having seen how to read the permissions on a share its time to turn to one of the other common tasks associated with shares – adding permissions.  This is usually done when the share is created but there are scenarios where you need to add extra permissions. I’ve written the function Add-SharePermission to accomplish this […]

under: PowerShell and CIM, PowerShell and WMI, PowerShell V3, PowerShell v4

I’ve written about working with share permissions a couple of times but a post on the forum (powershell.org) got me thinking about it again.  This time I’m going to use the CIM cmdlets rather than the WMI cmdlets I’ve used in the past. My test machine has a test share called Test2April so that’s what […]

under: PowerShell and CIM, PowerShell and WMI, PowerShell V3, PowerShell v4

Its relatively straightforward to find the domain controllers in your AD domain and its equally as straightforward to find the sites in your AD forest. Discovering which domain controllers are in which site is a bit more problematic. One way is look at the nTDSDSA objects. These are in the configuration naming context and their […]

under: PowerShell and Active Directory

A question on the (powershell.org) forum described a situation where the user was trying to use Set-WmiInstance to set a property on a particular WMI class instance. The attempt failed and the message “Provider is not capable of the attempted operation” was part of the reported exception. This message very often indicates that you are […]

under: PowerShell and CIM, PowerShell and WMI, PowerShell V3, PowerShell v4

When you create a new Windows server it usually assigns a name of its own. I always prefer using my own names for servers – I usually create the name so it gives some indication of the machine’s purpose. Renaming a computer is simple On the local computer run Rename-Computer -NewName test01 -Force –Restart This […]

under: PowerShell V3, PowerShell v4, Windows 2012 R2, Windows Server 2012

« Newer Posts - Older Posts »

Categories