• Changing the code in setupbindings will make this actually useful, amazed Alex has survived 15 years as an MCSE with code like this


    Update the get-website portion to look like this: get-Website | ? {$_.Name -eq $WebSiteName} and it will only update bindings on the site you want it to, instead of every site in IIS

  • This looks interesting, I am interested in looking at the Webserivce.AD.Usr.Mgmt.ps1 will it be possible to get the file to try it out.

  • @JW:  If it is just the number of columns that is the issue, you should be able to break it up with multiple passes and Select-Object.

    $CSV = Import-CSV -path c:tempmyfile.csv
    $CSV | Select-object -Property col1,col2,col3 | export-csv -path c:tempmyfile_a.csv -notypeinformation 
    $CSV | Select-object -Property col4,col5,col6 | export-csv -path c:tempmyfile_b.csv -notypeinformation

    Something like that.  The biggest thing is figuring out how you want to chunk it up.


    @Anele - there is a way to split this up into multiple columns, I'll see if I can find the article on how to do that.


    David F.

  • Good day, I appreciate your assistance. However my problem is filtering column rows in a said csv file. The csv file has a header which is "Comment" and I would like to filter with multiple comments

  • Hi, Checker33. Thank you for the feedback, I am glad you found this useful.

    Yes, you may include the function in a custom PowerShell Module that you can load manually or automatically in your PowerShell console, editor etc. If the previous sentence sounds intimidating, create a new file with the extension ".psm1" (like "MyCustomfunctions.psm1"). Paste the code from this post in the psm1 file, and save it. When you want to run the function, import the module (Import-Module 'C:tempMyCustomfunctions.psm1") and then the function will be available.

    You may also save as a normal PowerShell script file (PS1), and then reference it using the . (dot). Yes, the command begins with a dot followed by a space and then the path to the PS1 file.

    . "C:tempMyCustomfunctions.ps1"

    If you're interested in more details, I could write a post on how to do this (both manually or automatically).

    Cheers. Emanuel

  • Hi, very helpful. But how can i wrap this , so use the function under domain administrator creds?

  • $MailParams = @{
      SMTPServer  = 'mail.domain.com'
      Port        = 25
      To          = 'user@domain.com'
      From        = 'someotheruser@domain.com'
      Body        = 'Here is my attachment'
      Attachments = 'c:tempattachment1.zip','c:temptest.txt'
      Subject     = 'Testing attachment capabilities'
    Send-MailMessage @MailParams

    That's pretty much it. The attachments just need to be an array of paths to the items.


    David F.

  • Real nice article on filtering (in any way).
    A good way to start to understand it, with easy to follow examples.
    Using the same data and go from there really show how to handle all the different options.
    Wich more was like this (and a lot of them are, BUT just TOO hard to find). Thanks (saved the link - it will help me much)

  • Hello All,

    Can someone please post the working code for sending an attachment via email using Powershell. I have tried some online code, but I am unable to do so.



  • Noone said there is something wrong with the module you share 🙂 The question was about native export commands which is much easier and faster than learn how to work with a specific module.

  • Hehe thanks 🙂 Your welcome.

    I had the same issue few days ago when I audited few PCs... 🙂 Just did all on screen with format-table and when I was happy I just added | Export-CSV. It took me a while before I realized I forgot to remove the format thing 🙂

    Format commands are only used as last commands to display results, as they completely change the member type.

  • Any idea how to force the SNMP traps sent from windows to be sent in a version other than V1? They are showing up on the destination as V1 and not V2 or V2C. I have spent a few days now with this problem. Other than that, your post has been very helpful. Thanks!

  • Very good article thanks.

    Can I add that the command to  to load PoSh DHCPServer module is : 

    Add-WindowsFeature -Name DHCP –IncludeManagementTools

  • What's wrong with the ImportExcel module? (It can do all sorts of Excel things.....)

  • A DHCP server is a critical component of the IT infrastructure in most environments. In addition to monitoring, which ensures the basic availability of the service, you may also want to check the status of the IP scopes or leases. PowerShell provides several cmdlets for this purpose.

  • Excellent help, Leos. You are a real Pro, it works like a charm. Great help. Thank you so much.

  • oh and remove the -autosize parameter

  • Load More