Do you have any special characters, like dollar signs, in the password? Powershell may be trying to interpret them instead of just passing them on to net.exe.
Try putting single quotes around the password.
net use H: \\test10\c$ /user:"admin" 'admin'
net use H: /del
Your image shows that you launched Powershell_ISE with "run as administrator". You may be running into a conflict between elevated and non-elevated processes. Explorer does not run elevated. If the script normally runs unelevated, then test that way, don't use "run as administrator".
Net.exe doesn't know anything about Powershell error variables. You need to check $LASTEXITCODE.
$error.clear()
net use H: \\test10\c$ /user:"admin" "aaaaaaaaaaaaa"
"Net.exe RC=$LASTEXITCODE"
$error
$error.clear()
net use H: \\test10\c$ /user:"admin" "admin"
"Net.exe RC=$LASTEXITCODE"
$error
If you want to reference $error, then use the Powershell cmdlets instead of net.exe.
$User = ".\admin"
$PWord = ConvertTo-SecureString -String "admin" -AsPlainText -Force
$Cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $PWord
New-PSDrive H -PSProvider FileSystem -Root "\\test10\c$" -Credential $cred -persist
remove-psdrive H
$error.clear()
$User = ".\admin"
$PWord = ConvertTo-SecureString -String "aaaaaaaaaaaaa" -AsPlainText -Force
$Cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $PWord
New-PSDrive H -PSProvider FileSystem -Root "\\test10\c$" -Credential $cred -persist
$error[0]
$error[1]