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.3.6.0 plugins/hosts/windows/scripts/set_share.ps1
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.3.3.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.3.2.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.2.19.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.2.18.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.2.16.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.2.14.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-aws-mkubenka-0.7.2.pre.24 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-22795b161bf6/plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.2.10.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.2.9.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.2.8.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.2.7.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.2.6.2 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.2.6.1 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.2.6.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.2.5.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.2.4.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.2.3.0 plugins/hosts/windows/scripts/set_share.ps1
vagrant-unbundled-2.2.2.0 plugins/hosts/windows/scripts/set_share.ps1