This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function Invoke-ScheduledTask | |
| { | |
| [CmdletBinding()] | |
| param ( | |
| [Parameter(Mandatory = $true)] | |
| [String]$TaskName, | |
| [Parameter(Mandatory = $true)] | |
| [String]$command, | |
| [Parameter(Mandatory = $false)] | |
| [string]$Parameters, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Parse BCDedit enumation to a Powershell Object | |
| ## By Diagg/OSDC - 26/10/2021 | |
| ## Usage exemple: $Bcdedit|where Index -eq 0|select default | |
| $ObjName = $null ; $Val = 0 ; $Index = 0 ; $Bcdedit = @() | |
| $BcdString = bcdedit /v | |
| $BcdString|Foreach { | |
| If ($_.startswith('-')) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # OSFriendlyBuild.ps1 by Diagg/OSD-Couture.com | |
| $OSBuild = @{} | |
| $BuildNumber = (Get-ItemProperty 'HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion').CurrentBuild | |
| IF ([int]($BuildNumber) -lt 22000){$HTML = Invoke-RestMethod 'https://docs.microsoft.com/en-us/windows/release-health/release-information'} | |
| else {$HTML = Invoke-RestMethod 'https://docs.microsoft.com/en-us/windows/release-health/windows11-release-information'} | |
| $Pattern = '<strong>(?<version>.*)<\/strong>' | |
| $AllMatches = ($HTML | Select-String $Pattern -AllMatches).Matches | |
| ($AllMatches.Groups | Where-Object {$_.name -eq 'version'}).value -replace "Version " -replace "\(RTM\) " -replace "\(original release\) " -replace "\(OS build" -replace "\)"| ForEach-Object {$Htbl = $_ -split " "; $OSBuild[$Htbl[2]] = $Htbl[0]} | |
| Try {[System.Environment]::SetEnvironmentVariable('OSBUILD',$OSBuild[$buildnumber],'Machine')} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Inspiration from https://gist.github.com/d4rkeagle65/b9bc42a26be44a6d66c4858a4c3bc944 by d4rkeagle65 | |
| # Output to object by Diagg/OSD-Couture.com | |
| $Dsregcmd = New-Object PSObject ; Dsregcmd /status | Where {$_ -match ' : '}|ForEach {$Item = $_.Trim() -split '\s:\s'; $Dsregcmd|Add-Member -MemberType NoteProperty -Name $($Item[0] -replace '[:\s]','') -Value $Item[1] -EA SilentlyContinue} | |
| # to vue full objest type : $Dsregcmd | |
| # to vue property TenantID : $Dsregcmd.TenantId |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # By Diagg/OSDC | |
| # https://www.osd-couture.com/ | |
| # Twitter: @Diagg | |
| #V 2.0 - Logic refactored, Added support for X86 powershell on X64 windows | |
| #V 1.0 - Initial release | |
| # Get Workgroup/AD User | |
| $CurrentLoggedOnUser = (Get-CimInstance –ClassName Win32_ComputerSystem | Select-Object -expand UserName) | |
| If ([String]::IsNullOrWhiteSpace($CurrentLoggedOnUser)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Stops edge from taking over as the default .PDF viewer | |
| Write-Output "Stopping Edge from taking over as the default .PDF viewer" | |
| # Identify the edge application class | |
| $Packages = "HKCU:SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\Repository\Packages" | |
| $edge = Get-ChildItem $Packages -Recurse -include "MicrosoftEdge" | |
| # Specify the paths to the file and URL associations | |
| $FileAssocKey = Join-Path $edge.PSPath Capabilities\FileAssociations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Run Powershell scriptblock as Trusted Installer From Admin context (Yeah, MDT) using Scheduled Task. | |
| # Credit due to : https://www.tiraniddo.dev/2019/09/the-art-of-becoming-trustedinstaller.html | |
| $ScriptBlock = { | |
| $Script:TsEnv = New-Object PSObject | |
| $Script:TsEnv|Add-Member -MemberType NoteProperty -Name 'SystemHostName' -Value ([System.Environment]::MachineName) | |
| $Script:TsEnv|Add-Member -MemberType NoteProperty -Name 'SystemIPAddress' -Value (Get-NetIPAddress -AddressFamily IPv4 -PrefixOrigin Dhcp -AddressState Preferred).IPAddress | |
| $Script:TsEnv|Add-Member -MemberType NoteProperty -Name 'SystemOSversion' -Value ([System.Environment]::OSVersion.VersionString) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Run task as Trusted Installer From system context (Yeah, Intune, SCCM) | |
| # Should also work under Admin context (if not, remove all references to $P). | |
| # Credit due to : https://www.tiraniddo.dev/2019/09/the-art-of-becoming-trustedinstaller.html | |
| $a = New-ScheduledTaskAction -Execute notepad.exe | |
| $P = New-ScheduledTaskPrincipal -GroupId "BUILTIN\Administrateurs" | |
| #$P = New-ScheduledTaskPrincipal -GroupId "BUILTIN\Administrators" #Warning: the admin Group name is localised | |
| Register-ScheduledTask -TaskName 'TestTask' -Action $a -Principal $P |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ######################### | |
| # | |
| # Set-DefaultAppAsociation | |
| # | |
| # Version 3.0 By Diagg/OSD-Couture.com | |
| # XML node creation part by Helmut Wagensonner (https://blogs.msdn.microsoft.com/hewagen/making-file-type-associations-enterprise-ready/) | |
| # Release Date 01/10/2019 | |
| # Latest relase: 06/01/2020 | |
| # | |
| # Purpose: Create file association on the fly during MDT/SCCM deployment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function Install-WEBService | |
| { | |
| [CmdletBinding()] | |
| Param | |
| ( | |
| [Parameter(Mandatory=$true,position=0)] | |
| [String]${_0_User}, | |
| [Parameter(Mandatory=$true,position=1)] | |
| [String]${_1_Password}, |
NewerOlder