Scripts By Frank ERBLAND

  • Measure-ScriptBlockAverageTime.ps1 by Frank ERBLAND 22 Apr 2011 02:05 AM UTC
    by 2 users

    Beginner Event 10
    2 Comments

    This script measure the average time a scriptblock takes to execute. It runs the scripblock n times and compute the average time with Measure-Command cmdlet. It display a formal message according the asked time unit. By default : It measures the scriptblock {Start-Sleep -Second 5}, 5 times, and shows average result in milliseconds (with 5 digits after decimal point). It also writes the result to the pipeline as an Microsoft.PowerShell.Commands.GenericMeasureInfo object. Possible intermediate results in verbose mode and a progress bar.

  • Create-LogFile.ps1 by Frank ERBLAND 20 Apr 2011 07:50 PM UTC
    by 2 users

    Beginner Event 9
    1 Comments

    Create-LogFile.ps1 script creates a log file with a name following the pattern "year, month, day". It returns the full pathname of the log file on the pipeline.

  • GetFileInfo.psm1 by Frank ERBLAND 20 Apr 2011 01:35 AM UTC
    by 2 users

    Beginner Event 8
    1 Comments

    This function list all files in a folder and logs some informations in a unicode CSV file. Target folder [Path] and output file path [CsvPath] are MANDATORY parameters. The following informations are logged by default : Name, Size and Last write time, but other properties can be specified with parameter [Property]. The CSV file can be automatically opened with the switch [Open]. It launch the application associated with CSV.

  • Get-WindowsUpdateErrors.ps1 by Frank ERBLAND 18 Apr 2011 12:38 AM UTC
    by 2 users

    Beginner Event 6

    This script reports the Windows Update service fatal errors. By default it looks in the file %systemroot%\WindowsUpdate.log for lines matching the regular expression "FATAL: ". But you can specify alternate file name (if it changes in the future...) or matching regular expression (for warnings for example). This script simply relies on Select-String cmdlet...

  • Report-ServiceAccounts.ps1 by Frank ERBLAND 14 Apr 2011 01:44 AM UTC
    by 2 users

    Beginner Event 4

    This script list all the services on one or more computer and display the following informations: Computer name, start account name, service name and service display name. Default standard accounts are : "LocalSystem","NT Authority\LocalService" and "NT Authority\NetworkService" WMI errors are handled. Make sure you have sufficient credentials for remote computers.

  • Get-LogsDetails.ps1 by Frank ERBLAND 11 Apr 2011 11:31 PM UTC
    by 2 users

    Beginner Event 3
    1 Comments

    The Get-LogsDetails.ps1 script reports Event Log and ETL Log Details (log file size, log type (classic or not) and last write time). The logs list is sorted by last write time by default. Use switch [-SortBySize] for sorting descending by file size. The logs list is displayed to the console by default and you can use parameters [-ExportCSV], [-ExportHTML] and [-ExportXML] for additional silent export in CSV, HTML or XML files. Use the parameter [-ComputerName] for checking a remote computer.

  • Beginners2_2011.ps1 by Frank ERBLAND 10 Apr 2011 07:19 PM UTC
    by 2 users

    Beginner Event 2
    1 Comments

    This script list the running services that can be paused/suspended. The switch [-All] list all services, whatever their current state.

  • Beginners1_2011.ps1 by Frank ERBLAND 10 Apr 2011 01:22 AM UTC
    by 2 users

    Beginner Event 1
    2 Comments

    This script checks if a specific process is running (by its name) on a computer (localhost by default) and show if its build is private or not. For multiple computers scanning, use the pipeline... Note: It uses Get-WmiObject remoting capacity instead of Invoke-RemoteExpression.