Giter Club home page Giter Club logo

xsmbshare's Issues

Permission change doesn't take effect

Hi

I have created a share with xSmbShare and in NOAcces had "users"

Recently wanted to change Noaccess to "" and move "users" to ReadAccess, and allthough the Verbose runs says that the Set script i running, the share maintanes Noaccess for users, and completly ignores the newly added Read access

Seems like the script is trying to modify access, but it doesn't take effect.

PSVersion 5.1
xSmbShare 2.0.0
Server 2012 R2

Resource xSmbShare was not found

We used to use this resource without any problems, and suddenly it has started failing across all of our Windows 2012R2 Servers. Here is the output:

PS C:\Windows\system32> $PSVersionTable.PSVersion

Major Minor Build Revision


5 0 10586 117

PS C:\Windows\system32> get-dscresource xSmbShare

ImplementedAs Name ModuleName Version Properties


PowerShell xSmbShare xSmbShare 2.0.0.0 {Name, Path, ChangeAccess, ConcurrentUserLimit...}
PowerShell xSmbShare xSmbShare 1.1.0.0 {Name, Path, ChangeAccess, ConcurrentUserLimit...}

PS C:\Windows\system32> Invoke-DscResource -Method test -Name xSmbShare -Property @{Name='apps$';Description='apps folder share';Ensure='Present';Path='E:';FolderEnumerationMode='AccessBased';FullAccess=@('Everyone')} -Verbose -ModuleName xSmbShare
Invoke-DscResource : Resource xSmbShare was not found.
At line:1 char:1

  • Invoke-DscResource -Method test -Name xSmbShare -Property @{Name='app ...
  • - CategoryInfo          : NotSpecified: (:) [Invoke-DscResource], ArgumentException
    - FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.DesiredStateConfiguration.Commands.InvokeDscResourceMethodCommand
    

Unable to Add Domain User/Computer

I am using xSMBSHARE via dsc resource in chef recipe and able to enable share for local users but not able to share folder for any AD user/computer.

Below code i am trying :

Chef Recipe :

dsc_resource 'enable_file_share' do
resource :xSmbShare
property :name, 'QUORUM'
property :Path, 'D:\QUORUM'
property :FullAccess, ['domain_name\domain_Computer']
property :Description, "description goes here for this share"
property :PsDscRunAsCredential, ps_credential('domain_name\domain_user', 'XXXX')
end

After i ran chef recipe on Target Server, got the below error:

Running handlers:
[2017-11-07T10:05:08+00:00] ERROR: Running exception handlers
Running handlers complete
[2017-11-07T10:05:08+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 12 seconds
[2017-11-07T10:05:08+00:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stacktrace.out
[2017-11-07T10:05:08+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-11-07T10:05:08+00:00] FATAL: Chef::Exceptions::PowershellCmdletException: dsc_resource[enable_file_share] (dsc_coo
kbook::enable_file_share line 12) had an error: Chef::Exceptions::PowershellCmdletException: Powershell Cmdlet failed: N
o mapping between account names and security IDs was done.
+ CategoryInfo : NotSpecified: (MSFT_SMBShare:) [], CimException
+ FullyQualifiedErrorId : Windows System Error 1332,New-SmbShare
+ PSComputerName : localhost

The PowerShell DSC resource '[xSmbShare]DirectResourceAccess' with SourceInfo '' threw one or more non-terminating
errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel called
Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
+ CategoryInfo : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
+ PSComputerName : localhost

Please Help!

xSmbShare resource does not take into account properties other than Name, Path, Ensure when doing a Test-TargetResource

The xSmbShare resource always tests false on our staging server, so the share is re-created every time and configuration drift is always reported.
VERBOSE: [STGWEB1]: LCM: [ Start Resource ] [[xSmbShare]XX]
VERBOSE: [STGWEB1]: LCM: [ Start Test ] [[xSmbShare]XX]
VERBOSE: [STGWEB1]: LCM: [ End Test ] [[xSmbShare]XX] in 0.0160 seconds.
VERBOSE: [STGWEB1]: LCM: [ Start Set ] [[xSmbShare]XX]
VERBOSE: [STGWEB1]: [[xSmbShare]XX] Share with name XX exists
VERBOSE: [STGWEB1]: [[xSmbShare]XX] Setting FullAccess for Everyone
VERBOSE: [STGWEB1]: LCM: [ End Set ] [[xSmbShare]XX] in 0.1870 seconds.
VERBOSE: [STGWEB1]: LCM: [ End Resource ] [[xSmbShare]XX]

There's nothing configuration-specific to investigate (excerpt from function Test-TargetResource):
if ($Ensure -eq "Present")
{
if ($share -eq $null)
{
$testResult = $false
}
elseif ($share -ne $null -and $PSBoundParameters.Count -gt 3)
# This means some other parameter in addition to Name, Path, Ensure could have been specified
# Which means we need to modify something
{
$testResult = $false
}
else
{
$testResult = $true
}
}
Rather than verifying the current configuration, this test assumes $false if parameters other than Name, Path, or Ensure are provided.

Request - Should be able to pass empty strings to all but one Access Parameter.

When creating a share, currently it throws an error if an empty string is passed to ANY of the following permissions parameters; FullAccess, ChangeAccess, ReadAccess, NoAccess

Cannot validate argument on parameter 'FullAccess'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
+ CategoryInfo : InvalidData: (:) [], CimException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,New-SmbShare
+ PSComputerName : EDWDEV3-RPT

It would be much better if the error was only thrown if ALL permission parameters were unspecified.
This would make it much easier to pass a hashtable to set a lot of shares at the same time.
Not every type of permission would need to be specified for every share. Currently it is a challenge to dynamically drop parameters if the value you are passing is empty.
Example

foreach($Share in $Node.Shares) {
        $ShareName = 'ShareFolder' + $Share.Name
	xSmbShare $ShareName
	{
		DependsOn     = $FolderDependsOn
		Ensure        = 'Present'
		Name          = $Share.Name
		Path          = $Share.Path
		FullAccess    = $Share.FullAccess  
		ChangeAccess  = $Share.ChangeAccess
		ReadAccess    = $Share.ReadAccess
		NoAccess      = $Share.DenyAccess' 
	}
}

Permitting a PSD1 to contain the values

Shares = @(
	@{ 
		Name = 'ARCHIVE'
	        Path = 'E:\ARCHIVE'
		FullAccess = 'EDW_Admins'
		ChangeAccess = 'AZ\60061671'
		ReadAccess = 'Everyone' 
	},
	@{ 
		Name = 'DROPSERVER'
		Path = 'E:\DROP' 
		FullAccess = 'EDW_Supply'
		ChangeAccess = @('EDW_Ops', 'EDW_Admins')
		ReadAccess = '' 
	},
	@{ 
		Name = 'FTPDROP'  
		Path = 'E:\FTPDROP'
		FullAccess = ''
		ChangeAccess = 'Everyone'
		ReadAccess = ''
	}
)

Feature Request: Support Platforms where Get-SmbShare is Not Present

I've started exploring Powershell DSC and I'm now starting to run into limitations with several of the pack-in and external Resources.

This Resource (xSmbShare) does not appear to work in platforms where Get-SmbShare and its kin are not present, it also does not fail gracefully, instead attempting to continue on despite the inability to do so. One such platform is Windows Server 2008R2

Unfortunately our farm requires us to support Windows Server 2008 R2 for the near future (2012 R2 is on the board for our next Technology Platform).

While not as pretty as Get-SmbShare and its kin, the Resource could be refactored to support the older "NET" wrapper which would give you capability within all Windows Server Platforms Powershell DSC currently targets, this would be my route should I hear nothing back.

I'd assume I could probably work around this by doing some remapping of Get-SmbShare and its kin in the Powershell Environment that is in use (obviously being careful to mimic the existing API), anyone attempting to use this Resource in a Linux environment would probably have to travel the same road...

No option to disable continuous availability

By default, clustered file server shares are created with continuous availability turned on. This is not ideal for information worker workloads.

Adding a parameter to disable continuous availability would be helpful.

Parameters all need defaults

Unless you set all parameters this resource will execute every time.

This is due to the way the test for change is done. It will compare missing parameters (null) to a set paramter on the system and try and enact the change.

What if we have a lot of shares ?

Hello,

I see a lot of examples where you have to crate one or two shares.
How would you do I you had to cretaed hundreds of shares ?

regards
Thierry

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.