To Create file share folders if does not exists, below is the PowerShell code.
Test-path is PowerShell command let checks the existence of folder paths and using new-item command let you can create folders.
Code:
$sharearray ="fileshare1","fileshare2"
foreach ( $share in $sharearray)
{
if (-not (Test-Path -Path $share))
{
Write-host "$share not exists ,Creating it"
new-item -Path $share -ItemType Directory -Force
}
}
Regards,
Chaitanya