That's authentication – going to that UNC share is engaging the double-hop problem in Remoting. The easiest would be to ensure the share allows totally anonymous connections, or to copy the installer to the remote machine first, so it can install from local source.
To avoid double hop problem , i did copy the installer file locally using the command "Copy-Item -Path $source -Recurse -Destination $target" wherein $target is the server where I am wanting to install .net framework.
The problem is that it`s not even giving any error message when I run the script. It just keeps on running infinitely and I have to manually stop the script.
Although the installer file gets copied on the server but it does not continue with the installation.