Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System cannot find the file specified #3

Open
han44-illinois opened this issue Apr 6, 2022 · 3 comments
Open

System cannot find the file specified #3

han44-illinois opened this issue Apr 6, 2022 · 3 comments

Comments

@han44-illinois
Copy link
Contributor

I'm not sure what the cause of this is, but it seems worth noting.

On some systems when this module is run, a profile set for deletion returns the following error (including Loud outputs for additional context:

[2022-04-06 17:53:50:4755]             Profile deleted.
[2022-04-06 17:53:50:4755]         Time taken to delete: "00:00:00.0099937"
[2022-04-06 17:53:50:4755]     Processing profile: ""...
[2022-04-06 17:53:50:4755]         Current estimated deletion time: "00:01:00"
[2022-04-06 17:53:50:4755]         Time left before timeout: "04:59:25.8857125"
[2022-04-06 17:53:50:4855]         Looks like there's probably enough time for at least one more deletion.
[2022-04-06 17:53:50:4855]         Deleting profile...
Remove-CIMInstance : The system cannot find the file specified.
At C:\engrit\scripts\Remove-LocalUserProfiles.psm1:176 char:21
+                                     $profile | Remove-CIMInstance
+                                                ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Win32_UserProfi...14-32608244...):CimInstance) [Remove-CimInstance], CimException
    + FullyQualifiedErrorId : HRESULT 0x80070002,Microsoft.Management.Infrastructure.CimCmdlets.RemoveCimInstanceCommand

Unfortunately it's not consistent across the lab I'm running this on, so I'm unsure if this is a case where the user's profile folder is already missing when the script is run or some other issue.

@han44-illinois
Copy link
Contributor Author

Ah actually I just noticed, the line stating "Processing profile" appears to have a blank name for the profile it is attempting to delete. Perhaps the method used to populate this list is picking up nameless profiles somehow?

@mmseng
Copy link
Collaborator

mmseng commented Apr 6, 2022

Hmm, yeah I dunno. The method it uses to get profiles is $profiles = Get-CIMInstance -ClassName "Win32_UserProfile" -OperationTimeoutSec 300. So it would depend on what that's returning. I can see that maybe it would return corrupt profiles, or maybe it's timingout and getting partial data, or something. If you want, you could try running that line on a machine that has the issue and take a glance through what it returns. If we figure it out it would be fairly easy to add a quick check to skip profiles that are broken in whatever way these offending profiles are.

@han44-illinois
Copy link
Contributor Author

Sure, I'll give that a whirl tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants