Powershell as Administrator
# Create user vagrant with password vagrant
$username = "vagrant"
$password = ConvertTo-SecureString "vagrant" -AsPlainText -Force
# Disable password complexity policy
secedit /export /cfg C:\secpol.cfg
(gc C:\secpol.cfg) -replace "PasswordComplexity = 1", "PasswordComplexity = 0" | Out-File C:\secpol.cfg
secedit /configure /db secedit.sdb /cfg C:\secpol.cfg /areas SECURITYPOLICY
New-LocalUser -Name $username -Password $password -FullName "Vagrant User" -Description "User for Vagrant" -PasswordNeverExpires
Add-LocalGroupMember -Group "Administrators" -Member $username
# Re-enable password complexity policy
(gc C:\secpol.cfg) -replace "PasswordComplexity = 0", "PasswordComplexity = 1" | Out-File C:\secpol.cfg
secedit /configure /db secedit.sdb /cfg C:\secpol.cfg /areas SECURITYPOLICY
Remove-Item C:\secpol.cfg
## Set synced_folder with credentils inside Vagrantfile
config.vm.synced_folder ".", "/vagrant", type: "smb",
smb_password: "vagrant", smb_username: "vagrant"
Your vagrant up
logs should show something like
=⇒ default: Preparing SMB shared folders…
Vagrant requires administrator access to create SMB shares and may request access to complete setup of configured shares. => default: Setting hostname...
Note
|
This will mount your project folder to c:\vagrant .
Depending on your config this folder is only accassible for the vagrant user not the Administrator.
|