franklesniak / sysadmin-accelerator Goto Github PK
View Code? Open in Web Editor NEWSysadmin Accelerator is a set of reusable, reliable code that is useful for systems administration and related tasks
License: MIT License
Sysadmin Accelerator is a set of reusable, reliable code that is useful for systems administration and related tasks
License: MIT License
To get this path on Windows 9x, make sure profiles are enabled. Then, query:
Key: HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
Value name: Desktop
Then strip off the last folder name, which would be the localized name of the Desktop folder
It'd be great if SAA could query BIOS version information.
In Windows, the best way to do this seems to be:
Win32_BIOS -> smbiosbiosversion
and some people say Win32_BIOS -> releasedate is more reliable
There are other properties of interest, too:
biosversion (more of a display name, returns multiple strings in an array)
smbiosmajorversion (not sure how useful this is)
smbiosminorversion (not sure how useful this is)
For example:
Function ConvertToDotNetEscapedRegEx(ByVal strInputString)
Dim arrRegexCharactersToEscapeWithBackslash
Dim strEscapedString
Dim intCounterA
' Source: https://learn.microsoft.com/en-us/dotnet/standard/base-types/character-escapes-in-regular-expressions
' Also verified through testing in PowerShell
arrRegexCharactersToEscapeWithBackslash = Array("\", ".", "$", "^", "{", "[", "(", "|", ")", "*", "+", "?", "#", " ")
strEscapedString = strInputString
For intCounterA = 0 To UBound(arrRegexCharactersToEscapeWithBackslash)
strEscapedString = Replace(strEscapedString, arrRegexCharactersToEscapeWithBackslash(intCounterA), "\" & arrRegexCharactersToEscapeWithBackslash(intCounterA))
Next
' strEscapedString = Replace(strEscapedString, Chr(7), "\a") ' Not necessary; PowerShell 7.2.x on Windows 11 does not encode this character
' strEscapedString = Replace(strEscapedString, Chr(8), "\b") ' Not necessary; PowerShell 7.2.x on Windows 11 does not encode this character
strEscapedString = Replace(strEscapedString, vbTab, "\t") ' Chr(9)
' strEscapedString = Replace(strEscapedString, vbCrLf, "\n")
strEscapedString = Replace(strEscapedString, vbLf, "\n") ' Chr(10)
' strEscapedString = Replace(strEscapedString, Chr(11), "\v") ' Not necessary; PowerShell 7.2.x on Windows 11 does not encode this character
strEscapedString = Replace(strEscapedString, Chr(12), "\f") ' Chr(12)
strEscapedString = Replace(strEscapedString, vbCr, "\r") ' Chr(13)
' strEscapedString = Replace(strEscapedString, Chr(18), "\e") ' Not necessary; PowerShell 7.2.x on Windows 11 does not encode this character
ConvertToDotNetEscapedRegEx = strEscapedString
End Function
When there is no TPM present, both GetTPMInfo() and GetTPMInfoSimpleBoolean() should pass status back to the caller that indicate that there is no enabled/activated/ready TPM.
This issue is caused by TestTPMInstancesForActivatedTPMUsingTPMInstances(), TestTPMInstancesForNonActivatedTPMUsingTPMInstances(), TestTPMInstancesForDisabledTPMUsingTPMInstances(), TestTPMInstancesForEnabledTPMUsingTPMInstances(), TestTPMInstancesForNonReadyTPMUsingTPMInstances(), and TestTPMInstancesForReadyTPMUsingTPMInstances() returning unknown status because they cannot connect to the WMI TPM namespace when there is no TPM present.
Here is how to do this in VBScript: https://stackoverflow.com/a/968790/2134110
And in PowerShell:
([guid]::NewGuid()).Guid
Something along these lines:
Const LocalAppDataIdentifier = &H1C&
Dim objShellApplication
Dim objShellApplicationFolder
Dim objShellApplicationFolderItem
Dim strLocalAppData
On Error Resume Next
Set objShellApplication = CreateObject("Shell.Application")
If Err Then
On Error Goto 0
Err.Clear
Set objShellApplication = Nothing
strLocalAppData = ""
If DEBUG_ON = True Then
WScript.Echo("WARNING: Unable to create Shell.Application object. This may because Internet Explorer 4.0 or newer is not installed. Also, unable to determine the path to Local AppData.")
End If
Else
Set objShellApplicationFolder = objShellApplication.NameSpace(LocalAppDataIdentifier)
If Err Then
On Error Goto 0
Err.Clear
strLocalAppData = ""
If DEBUG_ON = True Then
WScript.Echo("WARNING: Unable to determine the path to Local AppData.")
End If
Else
Set objShellApplicationFolderItem = objShellApplicationFolder.Self
If Err Then
On Error Goto 0
Err.Clear
strLocalAppData = ""
If DEBUG_ON = True Then
WScript.Echo("WARNING: Unable to determine the path to Local AppData.")
End If
Else
strLocalAppData = objShellApplicationFolderItem.Path
If Err Then
On Error Goto 0
Err.Clear
strLocalAppData = ""
If DEBUG_ON = True Then
WScript.Echo("WARNING: Unable to determine the path to Local AppData.")
End If
Else
On Error Goto 0
If TestObjectIsStringContainingData(strLocalAppData) <> True Then
strLocalAppData = ""
If DEBUG_ON = True Then
WScript.Echo("WARNING: Unable to determine the path to Local AppData.")
End If
Else
If Right(strLocalAppData,1) <> "" Then strLocalAppData = strLocalAppData & ""
End If
End If
End If
End If
End If
' objShellApplicationFolderItem and objShellApplicationFolder don't need to stick around
Set objShellApplicationFolderItem = Nothing
Set objShellApplicationFolder = Nothing
WScript.Echo(strLocalAppData)
If the DWORD value HKLM\Network\Logon -> UserProfiles is 1, then user profiles are enabled.
If the DWORD value is absent or is not set to 1, then user profiles are not enabled.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.