• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
ControlUp Community

ControlUp Community

Connect, Learn, and Grow

  • Blog
  • Podcast
  • Meetups
  • Archives
  • Categories
    • ControlUp One Platform
    • ControlUp for Apps
    • ControlUp for Compliance
    • ControlUp for Desktops
    • ControlUp Scripts & Triggers
    • ControlUp Synthetic Monitoring
    • ControlUp for VDI
  • Topics
  • Events
    • Logos & Wallpaper
    • ControlUp.com
  • Join

Testing File Share Availability Using a Shell Scout

Posted on December 6, 2022

A user asked about testing file share availability which can be done wtih a Shell Scout – this can be done using a PowerShell script that checks the share and exits with a code != 0 if it fails. To handle permission access issues, a PowerShell script can be amended by adding a credential to the test-path command. More information can be found at: https://support.controlup.com/docs/shell-execution and https://devblogs.microsoft.com/scripting/powertip-test-the-presence-of-a-remote-share-by-using-powershell/.


Read the entire ‘Testing File Share Availability Using a Shell Scout’ thread below:

Hi everyone. I’m new to scoutbees and was wondering If anyone had done anything around testing a file share availability.


This could easily be done with a shell scout.


https://support.controlup.com/docs/shell-executionBasically have a script check the share. If it fails have the script exit with a return code of something other than 0.


Oh ok. That makes sense. I’m going to give it a try. Thanks for your help. I’m still trying to learn all the custom things the scouts can do.


@member – Welcome to Scoutbees. This is the perfect place to ask questions and get some great ideas on how to’s


Thanks @member. It’s been very helpful so far.


@member can you share what you got to work?


https://devblogs.microsoft.com/scripting/powertip-test-the-presence-of-a-remote-share-by-using-powershell/


$result = test-path \nas\files2

if ($result -eq $false){

write-host "Share not found."

Exit(1)

}I’ll check that out. I tried Get-ChildItem -path "UNC path to share name" -filter "a file I know exists here" -recurse

It works. I see exit code 0, but the stderr length show an access denied at path to ps1 file.


File: powershell.exe

Arguments: -file c:\tech\scripts\find_files.ps1

Date: Mon, 12 Dec 2022 17:12:57

Exit Code: 0

STDERR Length: test-path : Access is denied At C:\tech\scripts\find_files.ps1:2 char:1 + test-path \1001-2019-fs01\Core + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : PermissionDenied: (\1001-2019-fs01\Core:String) [Test-Path], UnauthorizedAccessException + FullyQualifiedErrorId : ItemExistsUnauthorizedAccessError,Microsoft.Powe rShell.Commands.TestPathCommand b

STDOUT Body:

FalsePretty sure you going to need to copy the ps1 local to the hive.


That’s what I get with:

test-Path \fileshare name

When I run in powershell it returns: True


Well… Stupid me. So the hive runs as localsystem and so does the powershell script. The system account doesn’t have rights to the share so this doesn’t work.


I’ll double check the share permissions. It should be set with domain users read execute. I’m seeing the scout as successful in scoutbees.


I tested using PSExec -s. Doesn’t work.



The ps1 file is on the hive server in c:\tech\scripts


Same here. c:\temp


Access denied is when running test-path. It doesn’t have permissions.That’s what it looks like but the test says successful.


Same here but its not.


You would have to change this script to use a credential for the test-path command.Are you getting access denied to the script or to the share?


Share. Running everything manually as system. System doesn’t have read rights.


I was able to get mine working. I gave EVERYONE read access to a file on the share.

Continue reading and comment on the thread ‘Testing File Share Availability Using a Shell Scout’.  Not a member? Join Here!


Categories: All Archives, ControlUp Scripts & Triggers, ControlUp Synthetic Monitoring
Topics: Credentials, Microsoft, PowerShell, SaaS & Web App Availability Testing, Scripts, Synthetic Monitoring

Ask Us Anything, Connect, Learn, and Grow with the ControlUp Community!

Login to the ControlUp Community to ask us anything, stay up-to-date on what’s new and coming soon and meet other like-minded techies like you.

Not already a member? Join Today!

Primary Sidebar

ControlUp Academy

Enroll in ControlUp Academy for expert-led technical training, equipping you with skills to effectively deploy, manage, and grow your ControlUp investment.

Learn here >

Rotating Images

Hidden Gem from our Community on Slack!

ControlUp Betas - What's Coming Next?
NEW ControlUp Features - Stay Up-to-Date!
ControlUp Scripts - Scripting, Zero to Hero
Latest KB Articles - Be the First to Learn
Did you Know - with Sivan Kroitoru
Practical Perspectives Technical Use Case Training

Video Tutorials Library

Visit our technical how-to videos, offering step-by-step tutorials on advanced features, troubleshooting, and best practices.

Watch here >

ControlUp Blog

Check out the ControlUp blog for expert advice and in-depth analysis.

Read here >

ControlUp Script Library

Visit the ControlUp technical script library, which offers a multitude of pre-built scripts and custom actions for your monitoring and troubleshooting requirements.

See here >

ControlUp Support

Visit the ControlUp support home and to delve deeper into ControlUp solutions.

Browse here >

Download ControlUp RealTime DX

Start with ControlUp for real-time end-user environment insights, swift troubleshooting, and unprecedented performance optimization. Download now.

Download here >

Footer

      

ControlUp Community
Of Techie, By Techie, For Techie!

Terms of Use | Privacy Policy | Security
Dive Deeper, Learn more at ControlUp.com

  • facebook
  • twitter
  • youtube
  • linkedin

© 2023–2025 ControlUp Technologies LTD, All Rights Reserved.

We use cookies to ensure that we give you the best experience on our website. by continuing to use this site you agree to our Cookie policy..