Sha256: c6262887c8d18754963fbdf1f4350282a8a9955ec7dae7bef62f09b51fb9f1d4

Contents?: true

Size: 1.03 KB

Versions: 36

Compression:

Stored size: 1.03 KB

Contents

# The names of the user are language dependent!
$objSID = New-Object System.Security.Principal.SecurityIdentifier("S-1-1-0")
$objUser = $objSID.Translate([System.Security.Principal.NTAccount])

$grant = "$objUser,Full"

for ($i=0; $i -le $args.length; $i = $i + 3) {
    $path = $args[$i]
    $share_name = $args[$i+1]
    $share_id = $args[$i+2]


    if ($path -eq $null) {
        Write-Warning "empty path argument encountered - complete"
        exit 0
    }

    if ($share_name -eq $null) {
        Write-Output "share path: ${path}"
        Write-Error "error - no share name provided"
        exit 1
    }

    if ($share_id -eq $null) {
        Write-Output "share path: ${path}"
        Write-Error "error - no share ID provided"
        exit 1
    }

    $result = net share $share_id=$path /unlimited /GRANT:$grant /REMARK:"${share_name}"
    if ($LastExitCode -ne 0) {
        $host.ui.WriteLine("share path: ${path}")
        $host.ui.WriteErrorLine("error ${result}")
        exit 1
    }
}
exit 0

Version data entries

36 entries across 32 versions & 5 rubygems

Version Path
vagrant-unbundled-2.2.0.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.1.4.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.1.2.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-packet-0.1.2 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/plugins/hosts/windows/scripts/set_share.ps1
vagrant-packet-0.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/plugins/hosts/windows/scripts/set_share.ps1
vagrant-packet-0.1.2 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/plugins/hosts/windows/scripts/set_share.ps1
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/plugins/hosts/windows/scripts/set_share.ps1
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/plugins/hosts/windows/scripts/set_share.ps1
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.1.1.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.0.4.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.0.3.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-aws-detiber-0.7.2.pre.4 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/plugins/hosts/windows/scripts/set_share.ps1
vagrant-aws-detiber-0.7.2.pre.3 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/plugins/hosts/windows/scripts/set_share.ps1
vagrant-aws-detiber-0.7.2.pre.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.0.2.0 plugins/hosts/windows/scripts/set_share.ps1