Scripts

Scripts that I have posted to various sites

12 Responses to Scripts

  1. patrymr93 says:

    Hi!
    I’m working on a powershell script to convert a docx to html, but with a different encoding than W-1252 because I’m tryling letter to send an email with the body on html and, as I am Spanish, I need accents and tildes to show up (those are appearing as ? right now). I tryied the method of saveas with all the parameters (ref: https://msdn.microsoft.com/en-us/library/office/aa220734(v=office.11).aspx) but i didn’t make it work. This is my script:

    Open word to add input into the signature file

    $MSWord = New-Object -ComObject word.application
    $MSWord.Documents.Open(“C:\Users\USER\Videos\CAMBIO_TURNO.docx”)
    $MSWord.Visible = $False

    # Save HTML
    $saveFormat = [Enum]::Parse([Microsoft.Office.Interop.Word.WdSaveFormat], “wdFormatHTML”);
    $path = “C:\Users\USER\Videos\CAMBIO_TURNO.html”
    $MSWord.ActiveDocument.saveas([ref]$path, [ref]$saveFormat)

    Close File

    $MSWord.ActiveDocument.Close()
    $MSWord.Quit()

    AND TO SEND IT TO ME

    C:\Users\GDOC-PatriciaFdez\Videos\convert-excel-to-html.ps1

    PARTE DEL SCRIPT DE EMAIL

    $OutputEncoding = [System.Text.Encoding]::UTF8

    $body = [IO.File]::ReadAllText(“C:\Users\USER\Videos\CAMBIO_TURNO.html”)

    send-mailmessage -to “EMAIL@EMAIL” -from “EMAIL@EMAIL” -subject “CAMBIO” -Body $body -Encoding $OutputEncoding -BodyAsHtml -Attachments “C:\Users\USER\Videos\CAMBIO_TURNO.xlsx” -dno onSuccess, onFailure -smtpServer smtp.gmail.com -Credential EMAIL@EMAIL

  2. Rusty Miller says:

    Need help with a script wasn’t sure if anyone can help
    I need a script to pull all users within AD which have an extensionattribute5 set to “2” from these users I need to pull the account with a password age greater the 180 days. Then the accounts that the script pulls need to subtract the 194 minus the password age in days . and send separate email for each account to a specified email address saying something like
    “Manager, The account for “User” password is currently “password age” old the password will expire in “194-password age” Days

    Can anyone help?

  3. Dale Bryan says:

    I would like to code a simple powershell script to have a computer do the following:
    1. login to a webserver that requires the client to have a PKI soft cert
    2. Upload a file to the webserver
    3. logout or exit the webserver

    I don’t know very much about powershell yet.

  4. Pingback: Powershell Learn Online | Easy Business Online Expert

  5. Greg says:

    Hi Boa,
    I am using your Get-Certificate.ps1 script to list certificates on windows servers.

    .EXAMPLE
    Get-Certificate -Computername ‘boe-pc’ -StoreName My -StoreLocation LocalMachine

        Thumbprint                                 Subject                              
        ----------                                 -------                              
        F29B6CB248E3395B2EB45FCA6EA15005F64F2B4E   CN=SomeCert                          
        B93BA840652FB8273CCB1ABD804B2A035AA39877   CN=YetAnotherCert                    
        B1FF5E183E5C4F03559E80B49C2546BBB14CCB18   CN=BOE                               
        65F5A012F0FE3DF8AC6B5D6E07817F05D2DF5104   CN=SomeOtherCert                     
        63BD74490E182A341405B033DFE6768E00ECF21B   CN=www.example.com
    

    Is there any way to list the field in the certificate called signature hash algorithm? I need to find out the certificate is a SHA1 or above.

  6. dnwhittaker says:

    Hi Boe,

    I ran across your scripts while doing some research for WSUS. I’m inheriting a system that is already configured, and I’m trying to tell what updates were assigned to the various computer groups. I had a question, “Is there a way to tell what update is assigned to a Computer group?” It doesn’t matter if it’s using the WSUS client, or a PowerShell script. Thanks in advance.

  7. Steve says:

    Hello

    Do you have any way that PowerShell (as admin) can read \.\physicaldrive0
    Get-Content and System.IO.File wont accept that
    Probabl;y need to p/invoke the win32 api ReadFile

    Thanks

  8. Boe – Great powershell scripts! I was wondering if your script for auto discovery and agent push for SCOM (SCOMAgentAudit.ps1) runs on SCOM 2012 R@. Been running into some errors, not sure if user or compatability. Thanks!

    • Boe Prox says:

      Let me know what those errors are. I can’t promise that I will have a fix for it because I do not have access SCOM 2012 R2, but can at least see what I can do.

Leave a comment