You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+37-1Lines changed: 37 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,28 @@
1
1
# Administrative scripts
2
2
Scripts for carrying out administrative tasks, mostly in Windows
3
3
4
+
## (Code snippets)
5
+
6
+
These items are not supposed to be run directly.
7
+
8
+
1.`Self-elevation framework.ps1`: Use this code snippet to enable your PowerShell scripts to check for administrative privileges, determine if they require it, and trigger a UAC prompt.
9
+
4
10
## AppX
5
11
6
12
Deals with Microsoft Store app packages.
7
13
8
14
1.`Inventory AppX Packages.ps1`: The `Get-AppxPackage` cmdlet in PowerShell can find all installed Microsoft Store apps, but it does not do a good job of discovering their display names. At best, it can show the technical package name. This script lists all AppX packages installed for the current user account, along with their display names. It accepts a `-Verbose` switch and its output can be piped to `Format-Table` or `Format-List`. I believe it can be expanded to work machine-wide.
9
-
2.`(Specialized) Remove these appx packages.ps1`: This one is mostly for me, but others can find educational value in it. This script uninstalls a number of Microsoft Store apps for all users, without deleting their provisioned packages. I believe it can only run on Windows 10 version 1809 or later.
15
+
2.`Reinstall-AppxPackages.ps1`: This script belongs to long-gone days. Nowdays, it is probably just dangerous. It is used to reset and re-register all AppX packages that were either shipped with Windows or were published by Microsoft. It is a safer alternative to the utterly sadistic oneliner that retrived a list of all AppX packages and reset them all.
16
+
3.`Repair system apps.ps1`: This script also belongs to long-gone days. Nowdays, it is probably just dangerous. It performs a Windows repair via DISM and SFC, then re-registers all AppX packages installed in the "SystemApp" folder.
17
+
4.`(Specialized) Remove these appx packages.ps1`: This one is mostly for me, but others can find educational value in it. This script uninstalls a number of Microsoft Store apps for all users, without deleting their provisioned packages. I believe it can only run on Windows 10 version 1809 or later.
18
+
19
+
## BITS
20
+
21
+
1.`Active BITS jobs - Detailed.ps1`: Asks the BITS service to give a list of all of its download and upload operations whose status is "Transferring". The result would be in the list form.
22
+
2.`Active BITS jobs - Table.ps1`: Asks the BITS service to give a list of all of its download and upload operations whose status is "Transferring". The result would be in the table form. I recommend maximizing your PowerShell window for this.
23
+
3.`All BITS jobs - Custom.ps1`: Asks the BITS service to give a list of all of its operation, then summarizes them, so that only the job state (color-coded), job ID, display name, type, priority, bytes transferred, and bytes total are shown, along with a list of all files in each job.
24
+
4.`Pending BITS jobs - Detailed.ps1`: Asks the BITS service to give a list of all of its download and upload operations whose status is anything but "Transferred". The result would be in the list form.
25
+
6.`Pending BITS jobs - Table.ps1`: Asks the BITS service to give a list of all of its download and upload operations whose status is anything but "Transferred". The result would be in the table form. I recommend maximizing your PowerShell window for this.
10
26
11
27
## Download
12
28
@@ -16,6 +32,26 @@ Deals with Microsoft Store app packages.
16
32
17
33
1.`Report status.cmd` reports whether Windows Firewall is on or off. It requires Windows 10.
18
34
35
+
## Icon cache
36
+
37
+
There was a period of time when Windows was plagued with bugs that corrupted the icon cache. These scripts were conceived in that time, as ways of mitigating the problem. I have long stopped using them though.
38
+
39
+
`Refresh icon cache with MoveFile.cmd` is the most effective of those but it is hard-coded to use an installed copy of `movefile.exe` from the Microsoft Sysinternals utility set.
40
+
41
+
## Last logon time
42
+
43
+
`lastlogon.vbs` takes a long time to run, but returns a list of all local users and the date and time of their last logon action.
44
+
45
+
A matter of licensing: I did not write this script. The user who posted it was called `Corvus1` and posted it in educational spirit.
46
+
47
+
## Microsoft Antimalware
48
+
49
+
This folder contains one script and two utility files for extracting Microsoft malware definition files from one computer and package them up into a self-extracting archive, so that it can be installed on other computers.
50
+
51
+
I conceived this script at a time when our network was suffering an infrastructure breakdown. Many of the computers had lost their Internet connectivity and users were using USB flash drives (notorious for being malware carriers) to transfer files. Those that had Internet connectivity were suffering from a bandwidth problem too, so downloading the official Microsoft antimalware package every day was not feasible. Windows 8.1's Windows Defender, however, could download minimal delta packages quickly.
52
+
53
+
In those dire situations, I wrote these scripts to keep a broken network secure and up-to-date.
54
+
19
55
## Shell
20
56
21
57
1.`PowerShell bug fix for 'Run with PowerShell' verb.reg` correctly registers Windows PowerShell with File Explorer. It is especially useful for those who have installed Visual Studio Code or have corrupted their .ps1 registration.
0 commit comments