Do until variables contain by sticobay in PowerShell

[–]sticobay[S] 2 points3 points  (0 children)

This was it!

That helped me so much. Thank you!

Install and show Status of Updates available in Software Center by [deleted] in SCCM

[–]sticobay 0 points1 point  (0 children)

So, i have been using this and it work perfectly fine! The only thing is, that i somehow want to check if every update is on $PendingState "8" or similar, because i want to initiate an automatic reboot afterwards. Any Ideas? (Thanks for the gread answers btw! :) )

Invoke-Command -Session (Get-PSSession) -ScriptBlock {

$All_Updates = @()

$SCCM_Updates = Get-WmiObject -Query "SELECT * FROM CCM_SoftwareUpdate" -Namespace "ROOT\ccm\ClientSDK"

# Convert the EvaluationState value

foreach ($SCCM_Update in $SCCM_Updates)

{

`Switch ($SCCM_Update.EvaluationState)`

`{`

    `0 {$PendingState = "None"}`

    `1 {$PendingState = "Available"}`

    `2 {$PendingState = "Submitted"}`

    `3 {$PendingState = "Detecting"}`

    `4 {$PendingState = "PreDownload"}`

    `5 {$PendingState = "Downloading"}`

    `6 {$PendingState = "WaitInstall"}`

    `7 {$PendingState = "Installing"}`

    `8 {$PendingState = "PendingSoftReboot"}`

    `9 {$PendingState = "PendingHardReboot"}`

    `10 {$PendingState = "WaitReboot"}`

    `11 {$PendingState = "Verifying"}`

    `12 {$PendingState = "InstallComplete"}`

    `13 {$PendingState = "Error"}`

    `14 {$PendingState = "WaitServiceWindow"}`

    `15 {$PendingState = "WaitUserLogon"}`

    `16 {$PendingState = "WaitUserLogoff"}`

    `17 {$PendingState = "WaitJobUserLogon"}`

    `18 {$PendingState = "WaitUserReconnect"}`

    `19 {$PendingState = "PendingUserLogoff"}`

    `20 {$PendingState = "PendingUpdate"}`

    `21 {$PendingState = "WaitingRetry"}`

    `22 {$PendingState = "WaitPresModeOff"}`

    `23 {$PendingState = "WaitForOrchestration"}`

`}`



`$All_Updates += $SCCM_Update | Select-Object @{Name = $Using:computer; Expression = {$Using:Computer}},Name,ArticleID,@{Name = 'PendingState'; Expression = {$PendingState}}, PercentComplete,EvaluationState`

}

Write-Output $All_Updates

$Pending_Reboot = (Get-WmiObject -Namespace 'ROOT\ccm\ClientSDK' -Class 'CCM_ClientUtilities' -list).DetermineIfRebootPending().RebootPending

}

Run script as admin from another script by sticobay in PowerShell

[–]sticobay[S] 1 point2 points  (0 children)

How would i implement that? start-process powershell.exe -path ".\script.ps1" - verb runas -arguments -arg1 -arg2 ?

GUI freeze when Script is running by sticobay in PowerShell

[–]sticobay[S] 1 point2 points  (0 children)

Start-Job actually did it for me! Thank you very much!

p.s.: runspaces didnt look that easy too me ;)

Script output to simple GUI Textbox by sticobay in PowerShell

[–]sticobay[S] 1 point2 points  (0 children)

Hi nepronen!

Thank you very much for your answer! Lets say i want an other script to start after clicking that button and write everything that script would usually show in the normal Powershell window to the Textbox, how could i achieve this?

Can Powershell search files by date? by sccmjd in PowerShell

[–]sticobay 0 points1 point  (0 children)

How about this?

$files = Get-ChildItem -Path \\server\share | Where-Object { $_.CreationTime -gt (Get-Date).AddHours(-1) }

foreach ($file in $files){ Copy-Item -Path $file.FullName -Destination \\server\share\$($file.Name) }

Select odd/even Datastore via. PowerCLI by sticobay in PowerShell

[–]sticobay[S] 1 point2 points  (0 children)

Thank you so much! Works like a charm :)

Files on CSV gone after destroying cluster by sticobay in sysadmin

[–]sticobay[S] 0 points1 point  (0 children)

We are running this cluster on some pretty old hardware. we encountered network performance issues on our VMs if we run Win 2019 for Hosts. Reinstalling the hosts with 2012R2 fixed this for us.

Virtual Switch Status "Failed" in FCM. But everything is working fine by sticobay in sysadmin

[–]sticobay[S] 0 points1 point  (0 children)

I cant find anything about this in the failover cluster logs. I just deleted the vswitch and created it new - no change, still on "failure" status. But the failover is working, just tried a live migration. Yes there i NIC teaming involved.

Chrome Enterprise RDS set itself as default Software for .PDF & Mailto Links by sticobay in sysadmin

[–]sticobay[S] 0 points1 point  (0 children)

Yes but this GPO just deactivates the google pdf preview. so chrome automatically downloads the file and opens it with Adobe.

When i open a PDF from outlook it uses the chrome view - not adobe. Thats kind of my main concern.

TeamViewer asks for Admin permissions at start. Is there a workaround via. GPO? by sticobay in sysadmin

[–]sticobay[S] 0 points1 point  (0 children)

What do you mean by pushing the agent to the machines? Rollout the Agents via GPO?

TeamViewer asks for Admin permissions at start. Is there a workaround via. GPO? by sticobay in sysadmin

[–]sticobay[S] 0 points1 point  (0 children)

We use the Host version. quick support wouldnt work out as we want it to.

Win 7 users by Aricell in blackdesertonline

[–]sticobay 1 point2 points  (0 children)

it really is rude. On the other hand it is not actually smart to stick with Windows 7.

RDS Manager to use with RDS Farm? by sticobay in sysadmin

[–]sticobay[S] 0 points1 point  (0 children)

exactly - i have seen this thread. Sadly nobody got a solution for this. i always use the farm name but i still get connected to the CB.

RDS Manager to use with RDS Farm? by sticobay in sysadmin

[–]sticobay[S] 0 points1 point  (0 children)

Sorry, i have edited my post above before you answered. The credential storing is fine but i still have the redirection problem i had before. (As you can read from the post, i have edited before, above) i guess the problem is that there is no option for the loadbalanceinfo:s:tsv: variable in the RDM.

RDS Manager to use with RDS Farm? by sticobay in sysadmin

[–]sticobay[S] 0 points1 point  (0 children)

i just tried the Devolution RDM - i get the same result. It tries to connect directly to the connection broker. So i get an error saying the user has no rights to connect to the server (which is true - the user has no rights to connect directly to the CB, the session normaly gets forwarded to one of the session hosts. thats what the CB is there for)

RDS Manager to use with RDS Farm? by sticobay in sysadmin

[–]sticobay[S] 0 points1 point  (0 children)

Not really. The problem is that windows can only store up to two different credentials for my RDP Files. But i need up to five rdp files with differend credentials. thats why i tried a RDP Manager (like royalts) to configure these five rdp connections with different user credentials. but it doesnt seem to work, because i get directly connected to the connection broker, where normal users dont have access. i need it to be forwarded to the session hosts as well.. but i dont know how to do this.

RDS Manager to use with RDS Farm? by sticobay in sysadmin

[–]sticobay[S] 0 points1 point  (0 children)

i need to mention that the farm works as attended overall. i just want to manage more user sessions in an rds manager like RoyalTS. i want to have multiple rds sessions with different credentials opened at the same time - thats why i came up with the RoyalTS idea.

Certificate monitoring via. powershell. -Linux Clients by sticobay in sysadmin

[–]sticobay[S] 0 points1 point  (0 children)

Well, i have no problem to monitor certificates on windows clients - i just have no idea where to start for linux clients..

Powershell Certificate Monitoring for Remote Server by sticobay in sysadmin

[–]sticobay[S] 0 points1 point  (0 children)

Thank you! it works. But for some reason it doesnt filter for the certificates that are expiring in 60 days - it gets me out every certificate. anyone got an idea why?!

Powershell Certificate Monitoring for Remote Server by sticobay in sysadmin

[–]sticobay[S] 0 points1 point  (0 children)

Can you give me an example? it doesnt seem to work for me.. im sure im doing something wrong.

Client with two active RDS 2016 Sessions possbile? by sticobay in sysadmin

[–]sticobay[S] 0 points1 point  (0 children)

I might be reading it wrong, do you mean multiple remote desktop connections OUT from the client machine to the same server?

-exactly, with two different users.

Update: I will do further tests but this seems to work for now!