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
<# | |
.NOTES | |
=========================================================================== | |
Created on: Feb/12/2020 | |
Updated on: Sep/09/2020 | |
Version : 1.0, Initial Release | |
1.1, Updated with timer function | |
Created by: Vinicio Oses | |
Organization: System Center Configuration Manager Costa Rica | |
Filename: Wipe-ConfigMgrAgent.ps1 |
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
$collectionIdList = @( | |
'SIH00021', | |
'SIH0001D', | |
'SIH00020', | |
'SIH00030', | |
'SIH00024', | |
'SIH0001F', | |
'SIH0002C', | |
'SIH0002B' | |
) |
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
# ============================================================================ | |
# Module: ServiceNowSecRMMSCCM.ps1 | |
# | |
# Purpose: Call Polypore.net ServiceNow REST API to get | |
# secRMM device ids by region. | |
# | |
# This powershell script is called by a cmd file named ServiceNowSecRMMSCCM.cmd | |
# This powershell script and the cmd file named ServiceNowSecRMMSCCM.cmd | |
# need to be in the same directory | |
# |
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
$path = "C:\Windows\Temp\Country.xml" | |
New-item $path -ItemType File -Force -ErrorAction SilentlyContinue | |
Set-content $path '<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend"> | |
<!--UserList--> | |
<gs:UserList> | |
<gs:User UserID="Current" CopySettingsToSystemAcct="true" CopySettingsToDefaultUserAcct="true" /> | |
</gs:UserList> | |
<!--DisplayLanguage--> | |
<gs:MUILanguagePreferences> |
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
$Inputprofile = "en-gb" | |
$inputlanguageid = "0809:00000809" | |
#https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-8.1-and-8/hh825682(v=win.10)?redirectedfrom=MSDN | |
$GeoID = "244" | |
#https://docs.microsoft.com/en-us/windows/win32/intl/table-of-geographical-locations | |
write-host "Successfully added variables inputprofile=$Inputprofile,inputlanguageid=$InputLanguageID and GeoID=$Geoid" | |
$path = "C:\Windows\Temp\Country.xml" |
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
$ColRegUinst = @() | |
(Get-Item -Path 'HKLM:\software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall').GetSubKeyNames() | | |
%{ | |
if ( (Get-Item -Path "HKLM:\software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\$_").GetValue("DisplayName") -ne $null) | |
{ | |
$ObjRegUinst = New-Object System.Object | |
$ObjRegUinst | Add-Member -Type NoteProperty -Name Publisher -Value (Get-Item -Path "HKLM:\software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\$_").GetValue("Publisher") | |
$ObjRegUinst | Add-Member -Type NoteProperty -Name Name -Value (Get-Item -Path "HKLM:\software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\$_").GetValue("DisplayName") | |
$ObjRegUinst | Add-Member -Type NoteProperty -Name Uninstall -Value (Get-Item -Path "HKLM:\software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\$_").GetValue("UninstallString") | |
$ColRegUinst += $ObjRegUinst |
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
<?xml version="1.0" encoding="utf-8"?> | |
<unattend xmlns="urn:schemas-microsoft-com:unattend"> | |
<settings pass="windowsPE"> | |
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"> | |
<Display> | |
<ColorDepth>32</ColorDepth> | |
<HorizontalResolution>1024</HorizontalResolution> | |
<RefreshRate>60</RefreshRate> | |
<VerticalResolution>768</VerticalResolution> | |
</Display> |
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
echo return = msgbox("Do you want to wipe the drive?", 4, "This is my title") > %temp%\msgbox.vbs | |
echo if return = 6 then >> %temp%\msgbox.vbs | |
echo wscript.quit(66) >> %temp%\msgbox.vbs | |
echo end if >> %temp%\msgbox.vbs | |
wscript %temp%\msgbox.vbs | |
if %errorlevel%==66 ( | |
echo select disk 0 > %temp%\diskpart.txt | |
echo clean >> %temp%\diskpart.txt | |
diskpart.exe /s %temp%\diskpart.txt | |
) |
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
Add-Type -AssemblyName System.Runtime.WindowsRuntime | |
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0] | |
Function Await($WinRtTask, $ResultType) { | |
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType) | |
$netTask = $asTask.Invoke($null, @($WinRtTask)) | |
$netTask.Wait(-1) | Out-Null | |
$netTask.Result | |
} | |
Function AwaitAction($WinRtAction) { | |
$asTask = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and !$_.IsGenericMethod })[0] |
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
<?xml version="1.0" encoding="utf-8"?> | |
<unattend xmlns="urn:schemas-microsoft-com:unattend"> | |
<settings pass="windowsPE"> | |
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"> | |
<RunSynchronous> | |
<RunSynchronousCommand wcm:action="add"> | |
<Description>BG Info</Description> | |
<Order>1</Order> | |
<Path>powershell.exe -executionpolicy bypass -file x:\RecoveryWipe.ps1</Path> | |
</RunSynchronousCommand> |