Quantcast
Channel: PowerShell.org » All Posts
Browsing all 13067 articles
Browse latest View live

Reply To: Powershell script designing

Doing this isn’t a good idea try { c:\Execute-Task1.ps1 -ErrorAction Stop c:\Execute-Task2.ps1 -ErrorAction Stop c:\Execute-Task3.ps1 -ErrorAction Stop } catch { throw } Why? Because you don’t know...

View Article


Reply To: Powershell script designing

Just depends on what your requirements for the error handling / reporting are. If all you’re doing is rethrowing the error (as in my example), there’s no advantage to having three separate try/catch...

View Article


Reply To: Powershell script designing

As a best practice you should always have the minimum code in your try block. if you aren’t going to be using the exception catching then why bother with it in the first place.

View Article

Exclude security groups from Get-ADUser

I’m new to Powershell and I’m trying to use Powershell to generate a list of inactive user accounts. I have been able to get this to work with some research and borrowing code from others. I now have...

View Article

Reply To: Exclude security groups from Get-ADUser

Well, it depends on the error you got of course – please always include errors – but I don’t think you can specifically do what you’re looking for in a single command. I don’t think AD actually tracks...

View Article


Reply To: Exclude security groups from Get-ADUser

Here is the error, but thanks for the assistance. I will try using Where. Get-ADUser : The input object cannot be bound to any parameters for the command either because the command does not take...

View Article

Reply To: Powershell script designing

In PowerShell, you can use try { whatever } catch { throw } to enforce consistent behavior from different sources of terminating errors; by default, some of them cause your current script or function...

View Article

Reply To: Require AD authentication before running script

Everything worked great, thank you so much for the help.

View Article


GPO Firewall edit

I was curious if anyone has had any experience editing firewall rules through group policy, specifically block IP rules. Scenario: I have a large text file full of IPs I would like to block in my AD...

View Article


Image may be NSFW.
Clik here to view.

Reply To: AD Groups: Creation and Updating

yeah…the “objVariable” stuff is left offer from losing marks way back when in a VB6 course…and wow, how I hated having to name variables like that Anyways…yes…the problem seems to be a delay....

View Article

Reply To: GPO Firewall edit

not sure what you are asking for The current GPO cmdlets don’t allow you to modify GPO settings. The only way I know of doing that is the commercial SDM software offering – sdmsoftware.com

View Article

Reply To: Powershell script designing

The PowerShell try-catch block is based on C# in that you try something and if a .NET exception is raised you can manage it in the catch block. To that end minimising the number statements within your...

View Article

Reply To: Exclude security groups from Get-ADUser

I think you can do this using Get-ADUser and the -Filter parameter. See if this works: $ExemptGroup = Get-ADGroup "Group Name Goes Here" # Fill this in and make sure it successfully finds the group...

View Article


Reply To: Powershell script designing

I understand that, and agree with it, if your intention is to actually handle a specific error from a specific statement. My point is that PowerShell behavior is not consistent when it encounters an...

View Article

Import-CSV | Export-HTML but format issues

Hello – I am trying to import a csv file that is generated by some database administrators and then I have to export the csv as an html email. I have the email working and the import is OK, but the...

View Article


Reply To: Import-CSV | Export-HTML but format issues

You’ll have to figure out how to take the extra stuff out of the CSV file – PowerShell won’t do that for you. One way is to use Get-Content to load the file, instead of Import-CSV; pipe the content to...

View Article

Access Issue

I am trying to access the entries for the 2013 Scripting Games and I always am redirected to the can’t find page.

View Article


Reply To: Access Issue

They’re no longer online. We don’t have a permanent archive.

View Article

Reply To: Import-CSV | Export-HTML but format issues

Hi Don Thank you as always, your training vids and books are helping quite a bit. I got rid of the #Name? mark from appearing by adding this into the script, but I don’t know why the name of the csv...

View Article

Reply To: Import-CSV | Export-HTML but format issues

So, look. If this is my CSV file: #NAME? hostname SQLInstance Database_Name Status Start_Time End_Time Backup _Size Server1 reports sysdba Yes 12/09/2013 23:09 12/09/2013 23:16 3730.31 server2...

View Article
Browsing all 13067 articles
Browse latest View live