Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


sysiq
  •  sysiq
  • Free support Topic Starter
2011-12-29T11:24:58Z
I am trying to run a Powershell script that deletes roaming profiles from a remote server. The script works fine from the VC server. But not from within Visual Cron. I get a "Cannot find path" error. Can somebody shine a light on this for me?

Here's the script:


$ProfilePath = "\\remote_server\c$\users\"
$Profiles = Get-ChildItem $ProfilePath

foreach ($Profile in $Profiles) {

  if($Profile.name -notlike "Administrator" -or $Profile.name -notlike "All Users" -or $Profile.name -notlike "Default User" -or $Profile.name -notlike "Default") {
  
    Remove-Item $ProfilePath$Profile -recurse -whatif

  }

}
Sponsor
Forum information
Support
2011-12-29T11:27:02Z
What if you use a Credential that matches a local admin - in the PowerShell Task?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
sysiq
  •  sysiq
  • Free support Topic Starter
2012-01-03T13:28:38Z
Sadly that does not make a difference.
Support
2012-01-04T07:44:20Z
I verified that this work. The Credential must not be a local user but a user on the remote account. Also, try not to use hidden folders ($) but make sure that folder is shared directly. Test this by adding it in Windows like \\servername\users and not \\servername\$c\users
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
erpomik
2012-01-21T14:31:38Z
You should also remember, that accessing the default administrative shares like C$, D$, etc. always requires credentials with administrative rights! Regardless of whatever permissions you might have set on these shares.

Best regards
Ernst Mikkelsen
Trifork A/S
Scroll to Top