Convert an object to a JSON string and JSON object
Convert an object to a JSON string and JSON object
Get-Date | Select-Object -Property * | ConvertTo-Json
View On WordPress
seen from China

seen from Malaysia
seen from Netherlands
seen from China
seen from Brazil

seen from Russia
seen from United Kingdom
seen from Türkiye
seen from China
seen from China

seen from Russia

seen from Indonesia
seen from Kuwait
seen from United States
seen from China
seen from Singapore

seen from United States
seen from United States
seen from China
seen from United States
Convert an object to a JSON string and JSON object
Convert an object to a JSON string and JSON object
Get-Date | Select-Object -Property * | ConvertTo-Json
View On WordPress
Utilizar Runspaces en PowerShell
#Crear Runspace #Runspace crear un hilo en el proceso existente $Runspace = [runspacefactory]::CreateRunspace() #Es necesario crear una instancia de PowerShell para ejecutar Runspace $PowerShell = [powershell]::Create() $PowerShell.runspace = $Runspace $Runspace.Open() [void]$PowerShell.AddScript({ Get-Date Start-Sleep -Seconds 10 }) $AsyncObject = $PowerShell.BeginInvoke() #Ver si se ha…
View On WordPress
Find day of the week by using PowerShell
Find day of the week by using PowerShell
(Get-Date 1/10/1981).DayOfWeek
View On WordPress
Listar el nombre los días de la semana en PowerShell
Listar el nombre los días de la semana en PowerShell
#Opción 1 (New-Object System.Globalization.DateTimeFormatInfo).DayNames #Opción 2 1..7 | % {(Get-Date).AddDays($_).ToString("dddd")}
View On WordPress
Ver los usuarios que no ha iniciado sesión en el Directorio Activo durante 100 días
Ver los usuarios que no ha iniciado sesión en el Directorio Activo durante 100 días
Get-ADUser -Filter * -Properties LastLogonDate | ? {$_.lastlogondate -ne $null -and $_.lastlogondate -le ((get-date).adddays(-100))} | Format-List Name,LastLogonDate
View On WordPress
Quicktip: Create an object that refers to its own properties
Quicktip: Create an object that refers to its own properties
Recently I received the question the /r/PowerShell community if it was possible to create an object that refers to its own properties when it is created. The user specified that they would prefer to create this as a one-liner. Using the Add-Member cmdlet in combination with the -Passthru parameter this is quite simple to do, for example: $Object = New-Object PSObject -property @{ Property1 =…
View On WordPress