r/PowerShell • • Jul 29 '18

Announcing PS Sysadmin Toolkit

Fellow Powershellers!

A few days ago I came up with the idea for module that would be a Toolkit of useful functions for system administrators. I posted a request for ideas over in /r/sysadmin, and the response was fantastic.

I'm happy to report that development is well underway. If you'd like to review the module, you may do so here: https://github.com/steviecoaster/PSSysadminToolkit

If you have an idea for a function that could be added to the module, please file an issue, and if you have code already written, do share if you are able, and I'll get it added in. Rather post it in the issue and I'll handle the rest, or submit a PR for me to merge.

The Master branch is relatively empty at the moment, I've got everything in the Dev branch until things are built enough to warrant a Release, at which time, I'll push to Master.

Any and all feedback is most welcome, and an extra set of eyes/hands from you fine folks is more than welcome.

118 Upvotes

27 comments sorted by

View all comments

2

u/Lee_Dailey [grin] Jul 29 '18

howdy steviecoaster,

have you tested the Get-SystemUptime function? [grin]

New-Object : Cannot find type [System.Collections.Generic.List]: verify that the assembly containing this type is loaded. At line:14 char:22

  • $UptimeObjects = New-Object System.Collections.Generic.List
  •                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException

    • FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

there are a lot of oddities in that bit of code. [grin] do you really want anything other than success OR a formal error? i tend to prefer to return "not found" sort of stuff, but others seem to pref feeding any errors to the error stream.

take care,
lee

2

u/[deleted] Jul 29 '18

Isn’t there an environmental variable for that already?

1

u/Lee_Dailey [grin] Jul 29 '18

howdy iwifia,

not on win7. [grin] i dunno about the new win versions, tho.

take care,
lee

2

u/[deleted] Jul 29 '18

It is on windows 7 with wmf 5.1. I am 99% sure I’ve used it before.

0

u/Lee_Dailey [grin] Jul 29 '18

howdy iwifia,

if it is there, i can't find it. [blush]

os = win7x64,sp1
ps = 5.1
wmf = 5.1

here's a list of the CMD EnvVars ...

ALLUSERSPROFILE
APPDATA
asl.log
ChocolateyInstall
ChocolateyLastPathUpdate
Chocolatey_Bin_Root
CommonProgramFiles
CommonProgramFiles(x86)
CommonProgramW6432
COMPUTERNAME
ComSpec
FP_NO_HOST_CHECK
HOMEDRIVE
HOMEPATH
LOCALAPPDATA
LOGONSERVER
NUMBER_OF_PROCESSORS
OS
Path
PATHEXT
PROCESSOR_ARCHITECTURE
PROCESSOR_IDENTIFIER
PROCESSOR_LEVEL
PROCESSOR_REVISION
ProgramData
ProgramFiles
ProgramFiles(x86)
ProgramW6432
PROMPT
PSModulePath
PUBLIC
SESSIONNAME
SystemDrive
SystemRoot
TEMP
TMP
USERDOMAIN
USERNAME
USERPROFILE
VBOX_MSI_INSTALL_PATH
windir

none of them have any uptime component that i can see. [grin]

take care,
lee