• I've written 2 PS scripts, one for our Dell Servers and one for our VM's that are extremely short and use an exported registry key for the different values of each type of server from 2 that I manually set up for the purpose of the scripts. The reason for two is that we use Dell OEM for hardware on the those physical servers and they have a specific setup for reporting to the OEM software. 

    My scripts are basic and go something like this:

     

    • Import a csv of the servers 
    • foreach the servers
    • verify SNMP isn't already installed
    • Skip server if it is already installed or continue if it isn't
    • upload the registry key
    • install windows service SNMP
    • import the registry key
    • repeat loop until done

    Just quick and simple.

  • I know this has been around for a while with no answers, but without knowing what type of mail system you are using it's hard to help. For Exchange you can use: Get-InboxRule to get a list. I will leave you with that to experiment if you ever come back to look at this post.

  • Hi,

    The Get-ComputerInfo cmdlet was introduced in Windows PowerShell 5.1. As mentioned earlier, you should check the version of PS being used on the computers you are trying to use the cmdlet on.

  • Ray posted a new activity comment 11 months ago

    I agree that this is a mess. I lost a lot of contacts while switching phones and had to go back to set it. Microsoft has a problem with understanding what should be default and what shouldn't. After many poor decisions in this area they would speak to the general public end users or at least to the IT departments that have contact with those end users and understand what the end users really uses and needs.
    • Hmm, you completely missed the point. Where is the alias of  Where-Object, but Adam is showing the difference between Where-Object and Where() method. The Where() method is different and not an alias of Where-Object.

    • While I capitalize my PowerShell code out of habit from coding in Pascal, Basic and C++, I don't really feel the need to do it for clean code or for anyone else reading my code. As long as the code is formatted properly, a capital Get-Service or a get-service shouldn't matter to anyone reading the code.

      If I'm writing something down and dirty in a one liner or a same script to get something done I'm not going to worry about capitalization. It's about getting the work done.

    • Ray posted a new activity comment 1 year, 7 months ago

      I believe Jeff Hicks has a script on Github called Auto-Lab for one of his courses on PluralSight.

    • There is no need to open and then save a document to make it understand PowerShell. Open Preferences and change the default language to PowerShell. Why not take the few seconds to make that change rather than open and immediately save? Open the document and start coding....much easier.

    • Thanks, this is a great addition to my arsenal. We have some data with leading zeros that this will save massive time.

    • I have found the first problem in that "State" is "Ready" instead of "Enabled" which is MS being non-standard in naming. Scheduledtaskstate is "Enabled" or "Disabled".

      Ray

    • Whether or not it shows that the switch is valid, it is not working correctly. I have scheduled tasks enabled. Tested it on a system that has 4 scheduled tasks that I set myself when the server was built. I also have all the default MS Windows tasks in one or the other state. All of my manually created tasks are enabled and run at defined times every day. They show successful and are confirmed successful by me verifying that the tasks copied and deleted the log files.

      I'm running PS 4 or 5 on all my servers currently, and the one I tested on is using PS4 as shown below. It is above PS3 which is the version that includes this

      Major Minor Build Revision
      ----- ----- ----- --------
      4           0           -1        -1

      Doesn't work when state is -eq Enabled, but pulls all MS Windows tasks when Disabled is selected. It does not pull any tasks from manually created scheduled tasks. It also does not pull any tasks MS Windows tasks that are enabled. The only way I have found to show all tasks correctly is the method I have provided in my first comment.

      Ray

       

    • Your command for getting the state doesn't work, The name "state" is not a proper name, After exporting to a csv I was able to see that it should be scheduledtaskstate. The following line gave me clear output for just the name and whether it was enabled or not.

      Get-ScheduledTask | ? scheduledtaskstate -eq Enabled | Select-Object Taskname, scheduledtaskstate

    • Ray became a registered member 2 years, 8 months ago