I am trying to run a logon script to capture the logged on user network drive map file system. I run the command locally on computer and it works fine. I get the computername and file system of network drive.
if i run it as a login script I get the computer name but never the file system. I have even tried to put a start-sleep for 2 minutes. I still do not get it.
You may be able to fix this with a pretty simple change. Right now you're using the Win32_LogicalDisk class for Get-WMIObject, where you may need to be using the Win32_MappedLogicalDisk class. I would change your code to look like the following and it should work at that point