Solved powershell script help please

Apple 604-1642 new imac 21.5 a1311 front...
September 23, 2014 at 08:04:23
Specs: mac maveriks
Hi everyone i am very new too powershell script writing and cannot seem to get my head around where to start off, i have limited knowledge on a cmd line level and am trying to create some advanced scripts, if anyone can help me with how to create controls for a program like vlc, i am a newbie i.t engineer and trying to gain as much knowledge as possible i will be so gratefull, thanks in advance!

See More: powershell script help please

Report •


✔ Best Answer
September 25, 2014 at 10:06:59
Before we begin, we should probably establish a baseline.

You should probably pick yourself up a script editor. I've heard good things about PowerShell Plus. As of v2, PowerShell comes with PowerShell ISE, and that's good enough for me.

I would recommend getting v3 of PowerShell. If you're running Win8.X, you already have v3. If you have Win7, you can download v3 free from MS at: http://www.microsoft.com/en-us/down....
v4's also available. I'm primarily in a mixed v2/v3 environment, but v4 should be backwards compatible with anything I come up with. http://www.microsoft.com/en-us/down...

Powershell can interact with 4 different environments, each of them have different rules and responsibilities. PS is built on and around .NET. As they say, you don't need to be a C# programmer to use PS, but it helps.
- Powershell's native is cmdlets. The focus is on PowerShell's object pipeline.
- Command line applications. A stream of text. What's permitted is dependent on if you're in the ISE or not. Programs that don't take keyboard input or have fancy text formatting are fine.
- .NET objects. The focus is on the objects, and you are responsible for the cleanup and fulfilling the object's requirements.
- Scriptable COM objects. The primary environment for VBScript. If you're just using COM, you're still probably better off using VBScript.

EDIT: PowerShell is a script engine that does not run scripts by default. Microsoft have softened on this view over the versions. However, you may attempt to run a script only to have PS say you cannot. It will point you to documentation on signing your scripts. There is an easier solution.

Set-ExecutionPolicy Unrestricted CurrentUser

I'll have to install VLC when I get a chance. The HTTP interface looks the most promising. Or at least we should be able to screen scrape with it. The process will require .NET object handling since PS doesn't have a cmdlet for websites.

Note we're only talking about doing this through VLC. The Internet is full of suggestions for media duration. None of them require VLC.

How To Ask Questions The Smart Way

message edited by Razor2.3



#1
September 23, 2014 at 12:24:25
"i am very new to powershell script writing"
"i have limited knowledge on a cmd line level"

"am trying to create some advanced scripts"

If you are new to it you start with simple commands or scripts then work up to advanced stuff. Like most things in life, you can't just jump in at the top without first learning the basics.

A book could be written about what you are asking.

Always pop back and let us know the outcome - thanks

EDIT: See later.

message edited by Derek


Report •

#2
September 24, 2014 at 08:40:40
Meh. Having a goal and working towards it is a good way to learn a programming/scripting language. I don't use VLC, but the documentation lists the different interfaces. (http://www.videolan.org/doc/play-howto/en/ch04.html). Read it, choose an interface, and let's go on from there.

How To Ask Questions The Smart Way


Report •

#3
September 25, 2014 at 01:39:25
Well Derek some of us learn better from delving straight in the deep end, and yes i have purchased books maybe instead of being facetious. maybe a better answer would of been what book to get that might help.. i did ask for information not a repeat of my original question.. considering your tag line is 'pop back and let us know the outcome' well your answer was purely terrible.

Thank you Razor2.3 see something simple as that link was a great help! Mainly i want to use the script to record on vlc i know you have not used it, but could a script be advanced enough to total the length of the film and minus off 1 second at the end? vlc is purely a test running activity.


Report •

Related Solutions

#4
September 25, 2014 at 07:18:45
Yeah OK, I can see what you are getting at, there are different ways of looking at things in all aspects of life. To dive in with a practical aim then learn the bits and pieces on the way through is another possibility. Mostly I prefer to start with simpler projects but I guess that's just personal preference.

Have struck out my earlier response as it has clearly offended you. Hope you accept my apologies - too many late nights on here maybe.

EDIT:
Reason for tag line is that on many forums here folk ask for help fixing computers and then vanish, leaving us with no idea what happened.

message edited by Derek


Report •

#5
September 25, 2014 at 10:06:59
✔ Best Answer
Before we begin, we should probably establish a baseline.

You should probably pick yourself up a script editor. I've heard good things about PowerShell Plus. As of v2, PowerShell comes with PowerShell ISE, and that's good enough for me.

I would recommend getting v3 of PowerShell. If you're running Win8.X, you already have v3. If you have Win7, you can download v3 free from MS at: http://www.microsoft.com/en-us/down....
v4's also available. I'm primarily in a mixed v2/v3 environment, but v4 should be backwards compatible with anything I come up with. http://www.microsoft.com/en-us/down...

Powershell can interact with 4 different environments, each of them have different rules and responsibilities. PS is built on and around .NET. As they say, you don't need to be a C# programmer to use PS, but it helps.
- Powershell's native is cmdlets. The focus is on PowerShell's object pipeline.
- Command line applications. A stream of text. What's permitted is dependent on if you're in the ISE or not. Programs that don't take keyboard input or have fancy text formatting are fine.
- .NET objects. The focus is on the objects, and you are responsible for the cleanup and fulfilling the object's requirements.
- Scriptable COM objects. The primary environment for VBScript. If you're just using COM, you're still probably better off using VBScript.

EDIT: PowerShell is a script engine that does not run scripts by default. Microsoft have softened on this view over the versions. However, you may attempt to run a script only to have PS say you cannot. It will point you to documentation on signing your scripts. There is an easier solution.

Set-ExecutionPolicy Unrestricted CurrentUser

I'll have to install VLC when I get a chance. The HTTP interface looks the most promising. Or at least we should be able to screen scrape with it. The process will require .NET object handling since PS doesn't have a cmdlet for websites.

Note we're only talking about doing this through VLC. The Internet is full of suggestions for media duration. None of them require VLC.

How To Ask Questions The Smart Way

message edited by Razor2.3


Report •

#6
September 29, 2014 at 05:18:49
thank you Derek, what sort of simpler projects do you reckon i should try?

i am awaiting books i have ordered and starting off using powershell v2 (as computer only has xp), would like to gravitate to C# and eventually C++ but thats a long road down the line, i would like to create scripts for windows operating systems for virus removal tool, instead of just software manipulation

Thanks Razor that is alot of information to go by! i think software manipulations seems harder to learn, my main idea is trying to create a script useful for those with viruses in oder to make it easier when configuring. Obviously this is going to take me time to figure out but have unlimited time to complete.

the script must (dependent if it boots) create a back up image using software like ghost or clonezilla and then.. create new administrator user, downgrade current users to non administrators, reboot and open new user in msconfig, map nas drive, copy users pics, docs, favs, music (did see a script on this site for that) to the nas and may then use a third party virus detection programme like cc cleaner all this is going to to is enable me to do is to cut out the boring and long-winded process into fixing a computer with viruses that are too slow to navigate through, then i can get onto the few remainder manual virus removal and configurations, more will then follow on the script, but this is more than enough to get me started. thanks guys i dont know how much help u can give a complete newbie, i see this amazing script recently and that is only reason why i have got into it.. im going to do lots of research and book reading


Report •

#7
September 29, 2014 at 08:35:27
Re: Simpler projects

I now accept that rather than just "practicing for the sake of learning" it is good to have something definite that you wish to achieve, as per #2, and learn that way. Maybe when I first started I only had the need (or daring) to create simple scripts. Forget #1 - it's only left there, struck out, because removing it would mean the follow up would make no sense.

EDIT:
Better add that I'm one of those 'orrible Windows people (LOL) so have severe limits on scripting with a Mac.

Always pop back and let us know the outcome - thanks

message edited by Derek


Report •


Ask Question