Posts

Showing posts with the label Script

Script to grab the Hardware hash for Autopilot

Procedure :- Save the first script as .cmd or with .bat extension. Save the Secound script as .PS1 extension.  Both the scripts should be saved in the same location ,C:\temp\HWID. Then trigger the .cmd file which will call the PS1.                                                                      Batch File

PowerShell Script to Domain Join

Image
 Domain Join - PowerShell Script Refer Below #************************************************************************************************************************ $ErrorActionPreference = "SilentlyContinue" Set-ExecutionPolicy remotesigned -Force $ErrorActionPreference Clear-Host Write-Host "*******************************************************************************"  -foregroundcolor "Green" Write-Host "File Name : Domain_Join.ps1"                  -foregroundcolor "Green"                                                                   ...

VB Scripting - Error Handling

Image
I am aware VB-Scripting is vanishing where PowerShell takes precedence, but still this post is for people who still use VB-script. The post talks about some of the rules that can be implied with error handling. Rules: Explicitly set error handling using the “On Error” statement. Explicit declaration makes it clear that error handling has been considered. Use “On Error GoTo 0” to turn off error handling.  With error handling turned off, a VB script will stop immediately upon encountering a run-time error.  This should only be used in circumstances where failure of the script is inconsequential. Use “On Error Resume Next” to turn on error handling.  With error handling turned on, a VB script will not stop execution.  Instead it attempts to run the next line, skipping lines that generate errors and running lines that do not.  With error handling turned on, it is important to check Err.Number to trap fatal error conditions. Process errors appropriatel...