Category: Scripting
-
Software Center – Application / Task Sequence stuck on Installing
Run Powershell Elevated or Start CMD as an Administrator net stop winmgmt /y winmgmt /resetrepository reboot PC Start CMD as an Administrator c:\windows\ccm\ccmrepair.exe
-
Remove HKCU registry entries of multiple users
Note: Current users logged on the system will be not affected because the ntuser.dat file is locked by the system.
-
Stop & Disable Service
-
Run MSI from PowerShell script with spaces in directories
Make use of double “” to add a single ” in a variable for paths that has spaces C:\Program Files (x86)\ThunderBolt 3 Update
-
GetLocalGroupsSID
$computerName = Read-Host ‘Enter computer name or press <Enter> for localhost’ $List = @{} if ($computerName -eq “”) {$computerName = “$env:computername”} $computer = [ADSI]”WinNT://$computerName,computer” $Users = $computer.psbase.Children | Where-Object { $_.psbase.schemaclassname -eq ‘group’ } foreach ($i in $Users) {$objUser = New-Object System.Security.Principal.NTAccount($i.Name) $strSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier]) $list[$i.Name[0]] = $strSid.Value } $list | ft
-
Powershell – Get VM Names, Serial Number, Bios UUID
Get-WmiObject -Namespace root\virtualization\v2 -class Msvm_VirtualSystemSettingData | select ElementName, BIOSSerialNumber, BIOSGUID | Sort-Object -Property ElementName
-
Hyper-V VM Scripts
<# ImportHyperVVM.ps1 Dries Willems 03/12/2014 #> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V –All -NoRestart Restart-Computer -Wait -For PowerShell -Timeout 600 -Delay 2 Import-Module Hyper-V $ethernet = Get-NetAdapter -Name ethernet $wifi = Get-NetAdapter -Name wi-fi New-VMSwitch -Name EthernetExternalSwitch -NetAdapterName $ethernet.Name -AllowManagementOS $true -Notes ‘Parent OS, VMs, LAN’ New-VMSwitch -Name WiFiExternalSwitch -NetAdapterName $wifi.Name -AllowManagementOS $true -Notes ‘Parent OS, VMs,…
-
How to add all users in an OU to a Security Group using Get-ADUser and Add-ADGroupMember
Get-ADUser -SearchBase ‘OU=DEV,OU=BuitenDienst,OU=Users,OU=Moto,DC=Com’ -Filter * | ForEach-Object {Add-ADGroupMember -Identity ‘GG_SDS_DEV_Caris_ML_PROD’ -Members $_ } http://oxfordsbsguy.com/2015/03/09/powershell-how-to-add-all-users-in-an-ou-to-a-security-group-using-get-aduser-and-add-adgroupmember/
-
Change Statuscode 3010 to 0
@echo off msiexec /I vc_red.msi TRANSFORMS=vc_red.mst /qn ALLUSERS=1 /L*v %windir%\temp\TEST_SDS_Microsoft_VC++RedistSU_2008SP1_1.0_EN_x86_Inst.log REBOOT=REALLYSUPPRESS if %errorlevel% == 3010 (exit /b 0) else (exit /b %errorlevel%)
-
SetUsersFullControl.ps1
$sharepath = “C:\SWL” $Acl = Get-ACL $SharePath $AccessRule= New-Object System.Security.AccessControl.FileSystemAccessRule(“Users”,”full”,”ContainerInherit,Objectinherit”,”none”,”Allow”) $Acl.AddAccessRule($AccessRule) Set-Acl $SharePath $Acl