PowerShell

  • Nice.  Just got me out of an awkward "how the hell can I do that" moment with a new (well old, Dell R410) server presented with where I suspected some failing drives but OM was not working, iDRAC6 too old to view storage, last backup 7 months ago and not rebooted for 4 months so not wanting to reboot it and get someone to look at BIOS or flashing lights.

    This has got ancient PowerShell too but got the core info showing 2 of 4 drives "non critical" but predicted failure.  Ouch.

    No reason why Solarwinds RMM can't use parameters as a task or daily / 24:7 check as I use both a lot, going to adjust and re-format this so it works with our servers and put it with my others below with link to your site.

    0
  • You would just call the function with the parameter of the path you wanted to measure.

    Something like:

    Get-FileSizeSum -FilePath c:windows -FilesOnly -Recurse

    David F

    0
  • Anyway to get the Description of a task? It could be a helpful variable for me...

    Register-ScheduledTask -Action $Action -Trigger $trigger -TaskName "Computer $Computer" -Description $Description
    
    (Get-ScheduledTask -TaskName $Task).Description (?)
    0
  • how should I feed the path? Please advise i'm a bit of novice.

    0
  • Hello,

    Thank you for this very helpful script!

    Now please, cold anyone advise, from this script, how you would trigger the following actions :

    ++ If highlight "option 1" menu, and press ok , the script will open a file located here :

    https://my.server.com/Word/Documents/MyDocument1.docx

    ++ If highlight "option 2" menu, and press ok , the script will open a file located here :

    https://my.server.com/Word/Documents/MyDocument2.docx

    etc..

    Many MANY thanks in anticipation!!

    Anthony

    0
  • So, CredSSP is bad since it is delegating your credential to remote computer when you you running the command and specifying this type of auth and if remote computre is compromised than your credentials can be reused for some not good purpose. Understood. 

    This solution suggests to create persistent PS Session config with domain credential which persists somwhere on the remore machine. So why does it better given the domain credentials are still given to remote machine? Is not it even worse since in case of CredSSP the credentials should be captured during their lifetime in lsass memory while in case of PS session configuration they are present on the remote machine constantly?

    0
  • Thanks for the response.

    But as I mentioned:

    If I log on to the machine directly using the same non-admin account (through RDP) then I am able to execute the command.

    So the command does not need admin rights when executed locally.

    What could stop it from running when executed through PS remoting is what I am trying to figure out.

    I appreciate your help.

    0
  • Link is broken... Looks like site no longer exists... If you want to read more about constructors, I recommend this article.

    0
  • I have enabled PS remoting for a non-admin account. I am able to run wmic and PowerShell commands but not this particular command:

    wmic service get

    If I log on to the machine directly using the same non-admin account (through RDP) then I am able to execute the command as this command.

    How do I enable the execution of the command remotely? Please explain.

    Thanks,
    Mani

    0
  • Paolo Maffezzoli posted an update in the group Group logo of PowerShellPowerShell 6 days, 21 hours ago


    The PowerShell 7 platform has received a new update. A preview for the upcoming version 7.2 is now available for download.
    0
  • Apparently in newer versions of the script these parameters don´t work:

    - passthru - I got to remove it

    - storename - i got to remove it

    - enhancedkeyusage - the "document encryption" option doesn´t work anymore. Some websites suggest to use type DocumentEncryptionCertLegacyCsp but it doesn´t work either

    Any way to solve this? I have googled around with no luck

    0
  • hi, when i use on line 93 $comGroupObj | ft -AutoSize outut is like this 

    Name       UserName   GroupName     
    ----       --------   ---------     
    pc1 monitoring Administrators

    Name       UserName   GroupName     
    ----       --------   ---------     
    pc2 monitoring Administrators

    Name       UserName   GroupName     
    ----       --------   ---------     
    pc3 monitoring Administrators

    can someone help me?

    0
  • That did not help me much to understand what are you trying to achieve. Having shared account for a training session is understandable, but I don't get the rest 🙂

    Anyway, you could create a simple script that will do a Start-Process powershell.exe -credential (get-credential) parameter and start your second script that will write the info to the file. If the start-process fails due to bad authentication, you can logoff the shared account.

    Make sure to enable this GPO option otherwise your users will not get the interactive Powershell window.

    0
  • These are not administrator accounts.  This usage is common in the military where you have someone "standing watch" and need a shared account so all have access to the same information.
    I saw this particular type of usage in a previous position where we ran training exercises over the course of several days using computers to drive the training scenario.  It was not wise to force users to logout and have another user login right in the middle of a battle.

    0
  • Can you describe your use case?

    Thinkgs like shared accounts should not be used for any administrative purposes. Why dont you simply add the needed permissions to a group of users? Then you would not have to do any tracking like this in first place.

    0
  • Load More
© 4sysops 2006 - 2020

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account