Hi
Like we discussed in comment; I higly recommand that settings firrst;
You need to create another for that one as it's a computer settings
Computer Configuration > Administrative Templates > System > Logon, enable the Always wait for the network at computer startup and logon setting.
I recommand it as the problem you have can happen if the computer execute the script before the network card receive the IP and be ready on the network, as such the script can fail to map.