Pavan'S Scripts
Wednesday, 23 July 2025
test
Monday, 24 June 2024
User based detection
Monday, 17 June 2024
User registry through PS
New-PSDrive HKU Registry HKEY_USERS | Out-Null
Sunday, 14 January 2024
Intune win32 app Create,Upload and deployment 1.0
Friday, 12 January 2024
PowerShell script to Auto upgrade the applications through winget
$apps = @(
Sunday, 19 November 2023
MSIX Codesigning Certificate
$pass = ConvertTo-SecureString -String "12345" -Force -AsPlainText
$thumbprint = (New-SelfSignedCertificate -Type Custom -Subject "CN=Microsoft Corporation" -KeyUsage DigitalSignature -FriendlyName “VLC Applicaton Certificate" -CertStoreLocation "Cert:\CurrentUser\My" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}")).Thumbprint
Export-PfxCertificate -Cert Cert:\CurrentUser\My\$thumbprint -FilePath "c:\temp\VLCmediaplayer.pfx" -Password $pass
Import-PfxCertificate -CertStoreLocation Cert:\LocalMachine\Root -FilePath "c:\temp\VLCmediaplayer.pfx" -Password $pass
Monday, 5 June 2023
Import TASK scheduler from xml file
$taskname = "Remove MSTeams (Public version)"
$taskxmlpath = "Path of the xml file"
$taskusername = "SYSTEM"
$taskexists = Get-ScheduledTask -TaskName $taskname -ErrorAction SilentlyContinue
If ($taskexists.TaskName -eq "$taskname") {
Write-host "$taskname -already exists"
}
Else {
Register-ScheduledTask -xml (Get-Content "$taskxmlpath" | Out-String) -TaskName "$taskname" -User $taskusername -Force
write-host "$tasname -registered"
}
PASADT to create form restart requirement
$proceed = 'RestartLater'
$noClickCounter = 0
while ($noClickCounter -lt 3) {
$noClickCounter++
$proceed = Show-InstallationPrompt -Title 'Restart Prompt' -Message "OHS Application Installation Completed. Click 'RestartNow' To Reboot the Machine.Click 'RestartLater' to Snooze the Restart for 1 hour. Deferral $noClickCounter" -ButtonRightText 'Restartnow' -ButtonLeftText 'RestartLater'
if ($proceed -eq 'RestartNow') {
Restart-Computer -Force
break
}
if ($noClickCounter -eq 3) {
$proceed = Show-InstallationPrompt -Title 'Restart Prompt' -Message 'OHS Application Installation Completed. Maximum Restart Diferrals Completed.Restart your Machine Now' -ButtonMiddleText 'Restart'
Restart-Computer -Force
}
else {
Sleep -Seconds 3600
}
}
Thursday, 25 May 2023
PSADT to create Form sample
$proceed = 'No'
$noClickCounter = 0
while ($proceed -ne 'Yes') {
$proceed = Show-DialogBox -Title 'Installation Notice' -Text 'Application is Installed, would you like to restart the machine?' -Buttons $([System.Windows.Forms.MessageBoxButtons]::YesNo) -DefaultButton 'First' -Icon 'Exclamation' -Topmost $true
if ($proceed -eq 'No') {
$noClickCounter++
if ($noClickCounter -eq 3) {
$proceed = Show-DialogBox -Title 'Installation Notice' -Text 'Application is Installed, would you like to restart the machine?' -Buttons $([System.Windows.Forms.MessageBoxButtons]::OK) -DefaultButton 'First' -Icon 'Exclamation' -Topmost $true
Restart-Computer -Force
}
else {
Sleep -Seconds 30
}
}
elseif ($proceed -eq 'Yes') {
Restart-Computer -Force
}
}
Tuesday, 7 March 2023
Wallpaer PS script
Add-Content $str_LogFile $str_LogEntry
test
$reboot = Get-PendingReboot Write-Log - Message "Checking for pending reboot status..." if ( $reboot .IsSystemRebootPe...
-
## Commonly used PSADT env variables $envCommonDesktop # C:\Users\Public\Desktop $envCommonPrograms # C:\Program...
-
$registryPath = "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Adobe\Adobe Reader\DC\FeatureLockDown" $Name = bSuppressSignOut $Value =...