Skip to content

Instantly share code, notes, and snippets.

View shinjijai's full-sized avatar

shinjijai shinjijai

View GitHub Profile
<#
.Description
Used to automate as much as possible the enabling of BitLocker.
.Synopsis
This script requires check-computer.ps1 function and also QuestActiveDirectoryManagement cmdlet
which is used in the check-computer.ps1, to validate computer host name.
Minimum version of PowerShell 3.0 is required, and some cmdlets work differently in the older version.
@shinjijai
shinjijai / Check-ExpiredPassword.ps1
Created December 16, 2019 19:07
Check ActiveDirectory user's password status
#Requires -Version 4.0
#Requires -Module ActiveDirectory
<#
.SYNOPSIS
Returns information on the user(s) account status.
.DESCRIPTION
Connects to the Active Directory that you are close to and pulls information from it.
Which means that information about the user that are not sync between ActiveDirectory
will not be accurate. But information like Days since password was set, will be valid, no matter what.
@shinjijai
shinjijai / SnipeIt.ps1
Created September 30, 2019 12:05
PowerShell function interactions with SnipeIT API
#Requires -Version 4.0
function Add-SILocation {
<#
.DESCRIPTION
Adds a new location to SnipeIT
#>
[CmdletBinding()]
[OutputType([psobject])]
param(
[Parameter(Mandatory=$true)]
@shinjijai
shinjijai / Get-NewPassword.ps1
Last active March 12, 2019 18:40
Generate a new password
function Get-NewPassword {
<#
.SYNOPSIS
Generates a random password.
.DESCRIPTION
Using Microsoft's password convention, this will generate a password with the first part consistenting of all character and a second part containting all numbers.
#>
[CmdletBinding()]
[OutputType([string])]
function Format-DisplayList {
<#
.DESCRIPTION
Display an array larger than certain members into nice column(s) for
easy readability. Added the ability to either use a number system or dashes
to display the list.
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$true,
@shinjijai
shinjijai / ReplicateServer.ps1
Last active July 25, 2018 13:04
Using RoboCopy to replicate a share from one server to another
<#
.DESCRIPTION
The process of copying and replicating the file server migration. Because RoboCopy is used, any files that are open will not be copied. So it'll be a good idea before making the file server switch to stop the shares on the old file server, and manually run the differential sync to make sure that all files are copied over.
.EXAMPLE
It's highly recommended that the intial sync should be done manually with the following:
.\replicateserver.ps1 -InitialCopy -SourceDirectory "\\Fileserver\Users" -DestinationDirectory "C:\Something" -LogLocation "C:\FileServerMove\Log" -LogName "Testing"
To schedule the subsequent differential syncs, set up a schedule task with the following:
@shinjijai
shinjijai / Export-RoomStatistics.ps1
Created June 19, 2018 12:42
Raw data dump of meetings for resource rooms
#Requires -Version 4.0
#Requires -modules ActiveDirectory
<#
.DESCRIPTION
This requires Exchange Web Service Managed API 2.2 tool which could be downloaded from
https://www.microsoft.com/en-us/download/details.aspx?id=42951.
.NOTES
Change the $From and $To to get a different date range information.This was created
to be ran manually, to get the raw data. The raw data should be imported into
@shinjijai
shinjijai / Import-ComputerInfo.ps1
Last active December 6, 2018 19:24
Using the files created by Export-ComputerInfo.ps1, export info to CSV
<#
.DESCRIPTION
This works with JSON files created by export_computerinfo.ps1
#>
$LogLocation = "\\samepath\as\export-computerinfo\"
$JSONFiles = Get-ChildItem -Path $LogLocation -Filter "*.json"
$FileName = "AllComputerInfo.csv"
$ReceiveAssetInfo = New-Object "System.Management.Automation.PSDataCollection[psobject]"
if($JSONFiles) {
$RunspacePool = [runspacefactory]::CreateRunspacePool(1,16)
@shinjijai
shinjijai / Export-ComputerInfo.ps1
Last active December 6, 2018 19:22
Login script to collect the computer and monitor(s) serial number and other info
#Requires -Version 4
<#
.DESCRIPTION
This is to capture information use to get more accurate information for inventory.
.NOTES
Used as part of the login process, it'll try to get the following infomation in JSON:
{
"Manufacturer": "Microsoft Corporation",
@shinjijai
shinjijai / HP_Warranty_Functions.ps1
Last active April 20, 2021 11:57
Functions to use with HP's Warranty APIs
<#
.DESCRIPTION
Using HP's warranty API (beta) to get warranty information on computer system.
To use this script, a valid HP developer API is required, and have to be enrolled CSS (https://developers.hp.com/css-enroll).
#>
function Get-AuthorizationToken {
<#
.DESCRIPTION
Using the APIKey and APISecret, this will retrieve a token that'll be required for every call made to the developer API.