If your script has just mounted a new drive, PowerShell may not immediately be able to access it (via Get-ChildItem, for example), because PowerShell did not yet update its drive list.
To update the PowerShell drive list, run this:
$null = Get-PSDrive