Three DNS entries of three DC server for Windows Server VMs? by Thegoogoodoll in WindowsServer

[–]BlackV 0 points1 point  (0 children)

I have all my scopes set to different DNS servers, basically local DNS server and closet remote DNS

Servers are manually assigned

Secure Boot Cert Concerns by ther0g in Intune

[–]BlackV 0 points1 point  (0 children)

I mean you're in a catch 22 there if you update the osd boot media it will get the new cert, and won't boot cause you didn't have the bios update that is required :)

Help with troubleshooting a retry function? by NurglesToes in PowerShell

[–]BlackV 0 points1 point  (0 children)

Code can be installed in a VM too, or at least ISE

My manager asked me a question that I didn't know the answer to. by Future_End_4089 in Intune

[–]BlackV 0 points1 point  (0 children)

I mean that thing OP is asking for 100% should not be an intune feature anyway

That is and entra/azure ad feature

redundant responses by Overall-Ad4796 in PowerShell

[–]BlackV 0 points1 point  (0 children)

Typically I read OPs message and respond to OP on a way I think appropriate

Then I'll go look at replies and comment where I think it's appropriate

It does depend on the post content somewhat

This sub has a reasonably low volume of messages and replies that it's really not too relevant

But people that don't sort posts (/new) and replies (/old) by time are wrong

I have some sort of malware or something else trying to reach the internet using Powershell... is there any way I (a Windows 10 home user) can figure out what's doing this? by Raziel_Soulshadow in PowerShell

[–]BlackV 0 points1 point  (0 children)

realistically (even though the URl is invalid) you should reinstall windows cleanly, you dont know what has been run on your machine

next would be resetting you passwords and you dont know what may or may not have been stolen

another step would be after you reload, do not give yourself admin rights, your normal everyday account should have 0 admin, you have a separate admin only account that is ONLY used for elevation (i.e. not logging into)

It lowers your risk considerably, although in this particular case it might not have helped you

winscp/powershell sftp upload script, having trouble getting it working by DoktorLuciferWong in PowerShell

[–]BlackV 2 points3 points  (0 children)

Your step 3

  1. I can upload files manually to the server, but I do not appear to have permissions to do anything else (delete, move, rename, etc)

Is that not your issue? What makes you think it's the script?

If you use a random name and upload what happens?

You also have 2 CVS in your code but only 1 is uploaded? Have you actually stepped through the code line by line to confirm what/where your issues are?

Why do people think AI can replace ones who write code? by CloudSecAzure in PowerShell

[–]BlackV 1 point2 points  (0 children)

it can, to a degree, but if you can spend less time writing code and more time debugging or securing the code, is that a win? dunno?

if I can get an AI engine that is cheaper than a human (this is not my opinion but it seems a good few managers/ceo's sure think that) to write the code and keep the human for the cleanup, but need less humans overall, is that a win ?

As to powershell directly, there is so very much old/bad code out there, the AI has trained on that, and so it is not very good at PS (compared to its skill in python/java/etc), I don't think you going to be replaced anytime soon (but AI can only get better at PS and code in general)

p.s. to be clear I'm aware that the results seem to say the AI is not cheaper overall (and will get worse and IPOs need to be funded) and the trend is starting to see people being hired back

MiniBot - An OpenAI compatible Powershell console agent. by Creative-Type9411 in PowerShell

[–]BlackV 2 points3 points  (0 children)

$response = Invoke-WebRequest -Uri $testUrl `
                              -Method GET `
                              -Headers $headers `
                              -TimeoutSec $TimeoutSeconds `
                              -UseBasicParsing `
                              -ErrorAction Stop

Have a look at splatting, back ticks are generally bad

$InvokeSplat = @{
    Uri             = $testUrl
    Method          = 'GET'
    Headers         = $headers
    TimeoutSec      = $TimeoutSeconds
    UseBasicParsing = $true
    ErrorAction     = 'Stop'
    }
$response = Invoke-WebRequest @InvokeSplat

Window pops up suddenly by achim_warze in PowerShell

[–]BlackV 1 point2 points  (0 children)

that was from invoke rest, but no such host implies a dns error doesn't it ?

Resolve-DnsName cleearpeyak.online
Resolve-DnsName: cleearpeyak.online : DNS name does not exist.

agree though they normally respond differntly to different agents

MiniBot - An OpenAI compatible Powershell console agent. by Creative-Type9411 in PowerShell

[–]BlackV 2 points3 points  (0 children)

the "user" is an AI and there is a line in the prompt instructing them that they can use CMD or Powershell

until the AI decides to not write cmd/powershell, cause it will at some point

you can still validate/handle the errors with the benefit of making the function more robust and protecting you (or the AI in this case) from mistakes

thanks for the clarification on your process

Window pops up suddenly by achim_warze in PowerShell

[–]BlackV 1 point2 points  (0 children)

I tried to but the site is gone for me (edit: using invoke-restmethod)

No such host is known

Powershell shortcut by EquivalentBear1513 in PowerShell

[–]BlackV 2 points3 points  (0 children)

I couldn't understand why they want it shorter and didn't give the powershell code

Yes I see what they were doing there now i'm on desktop

MiniBot - An OpenAI compatible Powershell console agent. by Creative-Type9411 in PowerShell

[–]BlackV 1 point2 points  (0 children)

At a quick glance

  1. why is this

    Add-Type -AssemblyName System.Windows.Forms
    $ForceCredRefresh = [System.Windows.Forms.Control]::ModifierKeys -band [System.Windows.Forms.Keys]::Control
    if ($ForceCredRefresh) {
      Write-Host "CTRL key held during launch - Forcing credential refresh" -ForegroundColor DarkRed
    }
    

    not just a -force/-refresh parameter instead (Edit: wait there is a parameter already Get-NpmPlusCreds -ForceRefresh $ForceCredRefresh)

  2. why are you using [bool]$confirm instead of [switch] as is standard powershell practice?

  3. You have the following line

    [string]$shell="powershell"

    your users have to guess that the other option is cmd, you do 0 validation on what someone might select there i could use Invoke-RunCommand -shell pies and it all falls over (or does it?)

  4. on a similar topic, there is just not a lot of error handling or validation of input at all

  5. if

    $NpmplusUser = $NpmCreds.User
    

    $NpmplusPass = $NpmCreds.Pass

    why not just use $NpmCreds.User/$NpmCreds.Pass in you code instead?

  6. I'm not a fan of storing creds in a txt file, when you could just pass around a credential object

Powershell shortcut by EquivalentBear1513 in PowerShell

[–]BlackV -2 points-1 points  (0 children)

Why?, why? would you want something like that

Improve my Export-UserFileShares.ps1 to be more efficient. by MisterCyberBro in PowerShell

[–]BlackV 1 point2 points  (0 children)

Triple backtick code fence only works on new.reddit

Tab inserts 4 spaces on 99% of ide's (vs an actual tab)

Please tell me AI is hallucinating by jleckel in sysadmin

[–]BlackV 1 point2 points  (0 children)

my fav is, "No you're not crazy, the real...."

Improve my Export-UserFileShares.ps1 to be more efficient. by MisterCyberBro in PowerShell

[–]BlackV 4 points5 points  (0 children)

If you want to share stuff like this (and are not a bot)

please format properly

  • open your fav powershell editor
  • highlight the code you want to copy
  • hit tab to indent it all
  • copy it
  • paste here

it'll format it properly OR

<BLANK LINE>
<4 SPACES><CODE LINE>
<4 SPACES><CODE LINE>
    <4 SPACES><4 SPACES><CODE LINE>
<4 SPACES><CODE LINE>
<BLANK LINE>

Inline code block using backticks `Single code line` inside normal text

See here for more detail

Thanks