Jump to content

 

I am by no means a programmer. I have very limited knowledge on C# and C++ but, I do know enough to tinker around with small things and get them up and running the way I want (sort of).

 

I was working with a fellow over on the unraid forums on setting up a PowerShell script to automatically convert my video media to a format this is more suitable for viewing no an iPad using handbrake CLI.

 

It was basically doing a "Watch Folder" set up. One of the issues I had with the script is that well basically I couldn't get it to run. The PowerShell window simply opens and then simply closes. When I use the default variables for the folder to be watched and the output segment the window stays open for a while (I assume looking for those paths). However, when I change them it as I said before simply closes outright. 

 

This script would be running on a fresh install of Windows 10 Pro on a VM of an unraid server with the latest version of PowerShell. 

 

Attached is the PowerShell Script. 

 

I did not write this. It seems that the guy who did is away for a while and I'm really wanting to get this up and running on my server. 

 

 

The main problem is that when I run the script on either the VM or my local machine after I change the target locations the script opens and then instantly shuts down. 

 


When I run the script from the PowerShell editor I receive this error:

+ $Host.UI.RawUI.WindowSize = $sizeWindow }

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException

+ FullyQualifiedErrorId : ExceptionWhenSetting

 

Another idea I had for the script (I wish I had the know how to do all of this), was to add a feature that gave the user the option to either convert files currently in the folder and watch the folder for new content, or just simply set it up as a watch folder script. 

 

I am aware there is software that will "Watch" a folder for changes. However, those software are not automated. However, if anybody knows of something different I can run on my VM that will accomplish all of this for free I'm all ears. 

 

Thank you very much in advance for anybody's help. I'm not much of a coder and if I need to make changes go easy on me. 

 

If this is not the place for this post please let me know as I will not make that mistake again.

 

Again Thank you. 

FileSystemWatcher.v1.1.ps1.txt

The Box - Unraid NAS

Case:  LIAN LI PC-A77B PSU: Seasonic X650

CPU: Xeon E3-1230 MB: SUPERMICRO MBD-X9SCM-F-O Memory:Crucial 16GB (2 x 8GB) DDR3 SDRAM ECC Unbuffered DDR3 1600  

HDD Controler: SUPERMICRO AOC-SASLP-MV8 & SUPERMICRO AOC-SAS2LP-MV8

Storage: 5x WD Red 4TB (one set as pairty drive) 5x WD Green 2TB HDD Accessories: 2x SUPERMICRO CSE-M35T-1B 3 x 5.25 (replaced included fan w/ Noctua NF-B9-1600)

 

Gaming system:

ASUS ROG G750JH Laptop (plan to buy a desktop eventually)

 

Link to comment
https://linustechtips.com/topic/536081-help-with-powershell-script/
Share on other sites

Link to post
Share on other sites

Any help on this, please?

The Box - Unraid NAS

Case:  LIAN LI PC-A77B PSU: Seasonic X650

CPU: Xeon E3-1230 MB: SUPERMICRO MBD-X9SCM-F-O Memory:Crucial 16GB (2 x 8GB) DDR3 SDRAM ECC Unbuffered DDR3 1600  

HDD Controler: SUPERMICRO AOC-SASLP-MV8 & SUPERMICRO AOC-SAS2LP-MV8

Storage: 5x WD Red 4TB (one set as pairty drive) 5x WD Green 2TB HDD Accessories: 2x SUPERMICRO CSE-M35T-1B 3 x 5.25 (replaced included fan w/ Noctua NF-B9-1600)

 

Gaming system:

ASUS ROG G750JH Laptop (plan to buy a desktop eventually)

 

Link to post
Share on other sites

No luck. Doing the exact same thing as before. I'm not sure. :| No errors when ran w/in the PowerShell editor. However, it just simply closes 

I think I'm going to give up on this endeavour. 

The Box - Unraid NAS

Case:  LIAN LI PC-A77B PSU: Seasonic X650

CPU: Xeon E3-1230 MB: SUPERMICRO MBD-X9SCM-F-O Memory:Crucial 16GB (2 x 8GB) DDR3 SDRAM ECC Unbuffered DDR3 1600  

HDD Controler: SUPERMICRO AOC-SASLP-MV8 & SUPERMICRO AOC-SAS2LP-MV8

Storage: 5x WD Red 4TB (one set as pairty drive) 5x WD Green 2TB HDD Accessories: 2x SUPERMICRO CSE-M35T-1B 3 x 5.25 (replaced included fan w/ Noctua NF-B9-1600)

 

Gaming system:

ASUS ROG G750JH Laptop (plan to buy a desktop eventually)

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×