Skip to content

Instantly share code, notes, and snippets.

@mavericksevmont
mavericksevmont / Create-NewProfile.ps1
Last active June 28, 2022 17:43 — forked from MSAdministrator/Create-NewProfile.ps1
PowerShell functions to create a new user profile
<#
.Synopsis
Rough PS functions to create new user profiles
.DESCRIPTION
Call the Create-NewProfile function directly to create a new profile
.EXAMPLE
Create-NewProfile -Username 'testUser1' -Password 'testUser1'
.NOTES
Created by: Josh Rickard (@MS_dministrator)
Date: 24MAR2017
Function Find-Window {
[CmdletBinding()]Param (
[string]$WindowName,
[int]$Retries = 10,
[int]$SleepInterval = 1000
)
[int]$CurrentTry = 0;
[bool]$WindowsFound = $false;
function Do-SendKeys {
param (
$SENDKEYS,
$WINDOWTITLE
)
$wshell = New-Object -ComObject wscript.shell
IF ($WINDOWTITLE) {$wshell.AppActivate($WINDOWTITLE)}
Start-Sleep -Milliseconds 500
IF ($SENDKEYS) {$wshell.SendKeys($SENDKEYS)}
}
@mavericksevmont
mavericksevmont / Get-Hash.ps1
Created December 15, 2021 01:08 — forked from jaredcatkinson/Get-Hash.ps1
PowerShell v2 port of the Get-FileHash function. This version of Get-Hash supports hashing files and strings.
function Get-Hash
{
<#
.SYNOPSIS
Get-Hash is a PowerShell Version 2 port of Get-FileHash that supports hashing files, as well as, strings.
.PARAMETER InputObject
This is the actual item used to calculate the hash. This value will support [Byte[]] or [System.IO.Stream] objects.
<#
Put together by Erick Sevilla: erick.sevilla@atos.net
Script to get installed software on remote machines.
Requires Hosts.txt file to feed server list in same folder as script
Output results in same folder
Added Parallel processing
#>
$Servers = Get-Content $PSScriptRoot\Hosts.txt
# Regex 1: https://regex101.com/r/Y3HJSf/2
# Regex 2: https://regex101.com/r/DQ9H7b/2
#Table
$Settings = (
"HP EliteBook 830 G5,01.11.01",
"HP EliteBook 840 G5,01.11.01",
"HP EliteBook 840 G6,01.05.03",
"HP EliteBook x360 1030 G2,01.34",
"HP EliteBook x360 1030 G3,01.11.01",
@mavericksevmont
mavericksevmont / Export-ExcelProject.ps1
Created November 19, 2020 22:08 — forked from atifaziz/Export-ExcelProject.ps1
PowerShell script to export VBA project components (classes, modules, etc.) from an Excel workbook
# Copyright (c) 2014 Atif Aziz. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
<#
Ping Machines Script
Draft to use as reference for Homework
#>
$Computers = Get-Content 'C:\Temp\Hosts.txt'
$Output = 'C:\Temp\Results.txt'
$var = foreach ($Computer in $Computers) {
if (Test-Connection -ComputerName $Computer -Count 1 -Quiet) {
# Function declaration
function Get-SpotifyTitle {
[cmdletbinding()] param([string]$TrackUri)
$Cont = Invoke-WebRequest -Uri $TrackUri
$Title = $Cont.ParsedHTML.Title
$SplitTitle = $Title -split ', a song by '
$Song = $SplitTitle[0]
$Artist = $SplitTitle[1] -replace ' on Spotify'
<# PowerShell Script to convert dbf file to csv (or almost anything else, really) without Excel.
Requires dBASE.NET.dll assembly: https://github.com/henck/dBASE.NET
This is a draft
#>
$Source = "$PSScriptRoot\da_md_wpa.dbf" # dbf file
$dll = "$PSScriptRoot\dBASE.NET.dll" # Assembly
$BaseName = (Get-Item $Source).BaseName
$Count = $null