{"id":997,"date":"2019-05-13T18:20:30","date_gmt":"2019-05-13T10:20:30","guid":{"rendered":"http:\/\/jrblog.pentaidea.com\/john\/2019\/05\/13\/powershell-commands-updating\/"},"modified":"2019-05-13T18:20:30","modified_gmt":"2019-05-13T10:20:30","slug":"powershell-commands-updating","status":"publish","type":"post","link":"https:\/\/john.pentaidea.com\/?p=997","title":{"rendered":"PowerShell\/Windows commands (updating)"},"content":{"rendered":"<p><span style=\"font-size: 14pt; color: rgb(30, 204, 255); font-weight: bold;\">PowerShell&nbsp;<\/span><\/p>\n<ul>\n<li>\n<p>Get CPU Memory usage<\/p>\n<\/li>\n<\/ul>\n<pre><code># CPU\n(Get-Counter &apos;\\Processor(_Total)\\% Processor Time&apos;).CounterSamples.CookedValue\n\n# Memory (MB)\n(Get-Counter &apos;\\Memory\\Available MBytes&apos;).CounterSamples.CookedValue\n<\/code><\/pre>\n<ul>\n<li>\n<p>Test SQL connect&nbsp;<\/p>\n<\/li>\n<\/ul>\n<pre><code>$sqlConnection = New-Object System.Data.SqlClient.SqlConnection $connectionString\n$sqlConnection.Open()&nbsp; &nbsp; # stop here, if just for connection test&nbsp;\n\n# With query\n$Command = New-Object System.Data.SQLClient.SQLCommand\n$Command.Connection = $sqlConnection\n$Command.CommandText = &quot;SELECT 1&quot;\n$Reader = $Command.ExecuteReader()\n\n# With response\n$Datatable = New-Object System.Data.DataTable\n$Datatable.Load($Reader)\n\n$sqlConnection.Close()\n<\/code><\/pre>\n<ul>\n<li>\n<p>Download zip and unzip<\/p>\n<\/li>\n<\/ul>\n<pre><code>Invoke-WebRequest -Uri &quot;https:\/\/download...zip&quot; -OutFile &quot;{path}&quot; | Extract-Archive -DestinationPath &quot;{path}&quot;\n(Invoke-WebRequest https:\/\/your\/url\/...).Content | Extract-Archive -DestinationPath C:\\Kellekek\\Microsoft\\PowerShell\\6.0.0-beta.8\n<\/code><\/pre>\n<ul>\n<li>\n<p>Get date string<\/p>\n<\/li>\n<\/ul>\n<pre><code>$(Get-Date -Format &quot;yyyyMMddTHHmmssZ&quot;)\n\n# UTC\n$(((get-date).ToUniversalTime()).ToString(&quot;yyyyMMddTHHmmssZ&quot;))\n<\/code><\/pre>\n<ul>\n<li>\n<p>Get server name<\/p>\n<\/li>\n<\/ul>\n<pre><code>PS C:\\app&gt; [System.Net.Dns]::GetHostName()\n<\/code><\/pre>\n<ul>\n<li>\n<p>One line command to find and replace string<\/p>\n<\/li>\n<\/ul>\n<pre><code>$file=&apos;c:\\app\\xxx.config&apos;; (Get-Content $file).replace(&apos;Encryption enable=&quot;true&quot;&apos;, &apos;Encryption enable=&quot;false&quot;&apos;) | Set-Content&nbsp;$file\n<\/code><\/pre>\n<ul>\n<li>\n<p>Loop execute each line-by-line<\/p>\n<\/li>\n<\/ul>\n<pre><code>kubectl get pods --no-headers -o custom-columns=&quot;:metadata.name&quot; | %{&nbsp;echo &apos;-------&apos; $_ $(kubectl top pod $_)&nbsp;}\n\n\n# %{} ------ loop all lines\n# $_ ------ get var\n<\/code><\/pre>\n<ul>\n<li>\n<p>Curl url without GUI&nbsp;<\/p>\n<\/li>\n<\/ul>\n<pre><code>curl $url -UseBasicParsing\nInvoke-WebRequest -Uri $url -UseBasicParsing\n<\/code><\/pre>\n<ul>\n<ul>\n<li>\n<p>error msg:&nbsp;The response content cannot be parsed because the Internet Explorer engine is not available, or Internet Explorer&apos;s first-launch configuration is not complete. Specify the UseBasicParsing parameter and try again.<\/p>\n<\/li>\n<\/ul>\n<li>\n<p>Get Virtual memory setting<\/p>\n<\/li>\n<\/ul>\n<pre><code>wmic computersystem get AutomaticManagedPagefile\n<\/code><\/pre>\n<ul>\n<li>\n<p>Get Virtual memory<\/p>\n<\/li>\n<\/ul>\n<pre><code>systeminfo | find &quot;Virtual Memory&quot;\n<\/code><\/pre>\n<ul>\n<li>\n<p>Get drive usage<\/p>\n<\/li>\n<\/ul>\n<pre><code>Get-PSDrive\n<\/code><\/pre>\n<ul>\n<li>\n<p>Check powershell version<\/p>\n<\/li>\n<\/ul>\n<pre><code>$Host.Version\n<\/code><\/pre>\n<ul>\n<li>\n<p>Search specific word in EventLog<\/p>\n<\/li>\n<\/ul>\n<pre><code>(Get-EventLog -LogName system -after (Get-Date).AddDays(-10) |\nSelect-Object -Property TimeGenerated,EntryType,Source,Message) -match &quot;nxlog&quot; |&nbsp;\nFormat-Table -wrap\n<\/code><\/pre>\n<ul>\n<li>\n<p>Grant permission<\/p>\n<\/li>\n<\/ul>\n<pre><code>C:\\&gt;icacls &quot;D:\\test&quot; \/grant John:(OI)(CI)F \/T\nAccording do MS documentation:\n* F = Full Control\n* CI = Container Inherit - This flag indicates that subordinate containers will inherit this ACE.\n* OI = Object Inherit - This flag indicates that subordinate files will inherit the ACE.\n* \/T = Apply recursively to existing files and sub-folders. (OI and CI only apply to new files and sub-folders). Credit: comment by @AlexSpence.\n\n\n========== Detail =========\nicacls &quot;&lt;root folder&gt;&quot; \/grant:r &quot;Domain Admins&quot;:F \/t\n\n\n\nFull Control (F)\nModify (M)\nRead &amp; Execute (RX)\nList Folder Contents (X,RD,RA,REA,RC)\nRead (R)\nWrite (W)\nTraverse folder \/ execute file (X)\nList folder \/ read data (RD)\nRead attributes (RA)\nRead extended attributes (REA)\nCreate file \/ write data (WD)\nCreate folders \/ append data (AD)\nWrite attributes (WA)\nWrite extended attributes (WEA)\nDelete subfolders and files (DC)\nDelete (D)\nRead permissions (RC)\nChange permissions (WDAC)\nTake ownership (WO)\n\nYou can also specify the inheritance for the folders:\nThis folder only\nThis folder, subfolders and files (OI)(CI)\nThis folder and subfolders (CI)\nThis folder and files (OI)\nSubfolders and files only (OI)(CI)(NP)(IO)\nSubfolders only (CI)(IO)\nFiles only (OI)(IO)\n<\/code><\/pre>\n<ul>\n<li>\n<p>Get full column message<\/p>\n<\/li>\n<\/ul>\n<pre><code>| format-table -wrap (-auto)\n<\/code><\/pre>\n<ul>\n<li>\n<p>Check OS version<\/p>\n<\/li>\n<\/ul>\n<pre><code>systeminfo | findstr \/B \/C:&quot;OS Name&quot; \/C:&quot;OS Version&quot;\n\n\n# Version 1709\nver\n# By registry key:\nreg query &quot;HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion&quot; \/v BuildLabEx\n\n# Ref:\nhttps:\/\/docs.microsoft.com\/en-us\/virtualization\/windowscontainers\/deploy-containers\/version-compatibility?tabs=windows-server-1909%2Cwindows-10-1809#querying-version\n<\/code><\/pre>\n<ul>\n<li>\n<p>Check shared folder connection<\/p>\n<\/li>\n<\/ul>\n<pre><code>net use \\\\server\\share \/user:&lt;domain\\username&gt; &lt;password&gt;\n<\/code><\/pre>\n<ul>\n<li>\n<p>Check permission to file\/folder<\/p>\n<\/li>\n<pre><code>Get-Acl -Path C:\\inetpub\\wwwroot\\App_Data\\MailSetting4Test.xm\nl | Format-Table -Wrap\n<\/code><\/pre>\n<li>\n<p>Get folder permission<\/p>\n<\/li>\n<\/ul>\n<pre><code>(get-acl &lt;folder name&gt;).access | ft IdentityReference,FileSystemRights,AccessControlType,IsInherited,InheritanceFlags -auto\n<\/code><\/pre>\n<ul>\n<li>\n<p>Get Disk usage<\/p>\n<\/li>\n<\/ul>\n<pre><code>Get-PSDrive\n<\/code><\/pre>\n<ul>\n<li>\n<p>Keep command updated (watch as linux)<\/p>\n<\/li>\n<\/ul>\n<pre><code>while (1) {your_command; sleep 5}\n<\/code><\/pre>\n<ul>\n<li>\n<p>Combine parameters with colon<\/p>\n<\/li>\n<\/ul>\n<pre><code>echo ${aa}:$bb\n<\/code><\/pre>\n<ul>\n<li>\n<p>Find command location<\/p>\n<\/li>\n<\/ul>\n<pre><code>(get-command notepad.exe).Path\n<\/code><\/pre>\n<ul>\n<li>\n<p>Connect and query to SQL&nbsp;<\/p>\n<\/li>\n<\/ul>\n<pre><code>$SqlConnection = New-Object System.Data.SqlClient.SqlConnection\n$SqlConnection.ConnectionString = &quot;server=XXX;database=XXX;uid=XXX;pwd=XXX;&quot;\n\n$SqlCmd = New-Object System.Data.SqlClient.SqlCommand\n$SqlCmd.CommandText = &quot;SELECT TOP 1 * FROM XXX&quot;\n$SqlCmd.Connection = $SqlConnection\n\n$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter\n$SqlAdapter.SelectCommand = $SqlCmd\n$DataSet = New-Object System.Data.DataSet\n$SqlAdapter.Fill($DataSet)\n$DataSet.Tables[0]\n<\/code><\/pre>\n<ul>\n<li>\n<p>Get the latest file in folder<\/p>\n<\/li>\n<\/ul>\n<pre><code>$a = Dir | Sort CreationTime -Descending | Select Name -First 1\ncd $a.name\n<\/code><\/pre>\n<ul>\n<li>\n<p>Select string by regex pattern<\/p>\n<\/li>\n<\/ul>\n<pre><code>Select-String -Path {name} -Pattern &apos;^.*\\&quot;fail\\&quot;\\:([0-9]+)\\,\\&quot;label\\&quot;\\:\\&quot;Critical Tests\\&quot;\\,\\&quot;pass\\&quot;\\:([0-9]+?)\\}&apos;\n<\/code><\/pre>\n<ul>\n<li>\n<p>Get domain name by IP<\/p>\n<\/li>\n<\/ul>\n<pre><code>nslookup {IP}\n<\/code><\/pre>\n<ul>\n<li>\n<p>Connect to Network sharing \u7db2\u8def\u4e0a\u7684\u82b3\u9130<\/p>\n<\/li>\n<\/ul>\n<pre><code>New-PSDrive -Name P -PSProvider FileSystem -Root \\\\{{folderPath}} -Credential domain\\{{userName}}\n<\/code><\/pre>\n<p>Notice: can&apos;t have the back slash at the end.<\/p>\n<ul>\n<li>\n<p>Get current folder path<\/p>\n<\/li>\n<\/ul>\n<pre><code>$pwd\n<\/code><\/pre>\n<ul>\n<li>\n<p>Disable firewall<\/p>\n<\/li>\n<\/ul>\n<pre><code>Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False\n<\/code><\/pre>\n<ul>\n<li>\n<p>Get AD user by identity<\/p>\n<\/li>\n<\/ul>\n<pre><code>Get-ADUser -Identity {{userName}} -Properties *\n<\/code><\/pre>\n<ul>\n<li>\n<p>Set\/Update AD password<\/p>\n<\/li>\n<\/ul>\n<pre><code>Set-ADAccountPassword -Identity john_jang -OldPassword (ConvertTo-SecureString -AsPlainText &quot;{{password}}&quot; -Force) -NewPassword (ConvertTo-SecureString -AsPlainText &quot;{{password}}&quot; -Force)\n<\/code><\/pre>\n<ul>\n<li>\n<p>Install HyperV on Windows Server<\/p>\n<\/li>\n<\/ul>\n<pre><code>Install-WindowsFeature Hyper-v\n<\/code><\/pre>\n<ul>\n<li>\n<p>Enable hypervisor<\/p>\n<\/li>\n<\/ul>\n<pre><code>bcdedit \/set hypervisorlaunchtype Auto\n<\/code><\/pre>\n<ul>\n<li>\n<p>Enable Nested HyperV &#8211; enable HyperV guest feature inside HyperV host.&nbsp; <a href=\"https:\/\/docs.microsoft.com\/zh-tw\/virtualization\/hyper-v-on-windows\/user-guide\/nested-virtualization\">ref<\/a><\/p>\n<\/li>\n<\/ul>\n<pre><code>Set-VMProcessor -VMName WinS_2019_rs5 -ExposeVirtualizationExtensions $true\n<\/code><\/pre>\n<ul>\n<li>\n<p>Install docker preview (support linux container) in Windows Server 2019&nbsp; <a href=\"https:\/\/www.altaro.com\/msp-dojo\/linux-containers-windows-server-2019\/\">ref<\/a><\/p>\n<\/li>\n<\/ul>\n<pre><code># Enable&nbsp;Nested HyperV and install HyperV first\nUninstall-Package -Name docker -ProviderName DockerMSFTProvider\nInstall-Module DockerProvider\nInstall-Package Docker -ProviderName DockerProvider -RequiredVersion preview\n\n# Switch to linux container\n[Environment]::SetEnvironmentVariable(&quot;LCOW_SUPPORTED&quot;, &quot;1&quot;, &quot;Machine&quot;)\nRestart-Service docker\n# Switch to Windows container\n[Environment]::SetEnvironmentVariable(&quot;LCOW_SUPPORTED&quot;, $null, &quot;Machine&quot;)\nRestart-Service docker\n<\/code><\/pre>\n<ul>\n<li>\n<p>Get current PowerShell version<\/p>\n<\/li>\n<\/ul>\n<pre><code>$PSVersionTable.PSVersion\n<\/code><\/pre>\n<ul>\n<li>\n<p><span style=\"font-weight: bold;\">Remote<\/span> scripting<\/p>\n<\/li>\n<\/ul>\n<pre><code>Enter-PSSession -ComputerName {ServerName}&nbsp; -Credential {domain\\name}\n<\/code><\/pre>\n<ul>\n<li>\n<p>Start windows service<\/p>\n<\/li>\n<\/ul>\n<pre><code>get-service *partOfServiceName*\nstart-service serviceName\nstop-service serviceName\n<\/code><\/pre>\n<ul>\n<li>\n<p>Operating windows service<\/p>\n<\/li>\n<\/ul>\n<pre><code>Get-Service *keyword*&nbsp; &nbsp; &nbsp;# Search by keyword\n\n\n# for PowerShellv5 and older version\n$service = Get-WmiObject -Class Win32_Service -Filter &quot;Name=&apos;servicename&apos;&quot;&nbsp; &nbsp;\n$service.delete()\n\n<\/code><\/pre>\n<ul>\n<li>\n<p>Operating the response from commands<\/p>\n<\/li>\n<\/ul>\n<pre><code>XXcommand | Select-Object -Expand Conlumn\n(XXcommand).ResponseColumn\n<\/code><\/pre>\n<ul>\n<li>\n<p>Send mail<\/p>\n<\/li>\n<\/ul>\n<pre><code>Send-MailMessage -From &apos;User01 &lt;user01@fabrikam.com&gt;&apos; -To &apos;User02 &lt;user02@fabrikam.com&gt;&apos;, &apos;User03 &lt;user03@fabrikam.com&gt;&apos; -Subject &apos;Sending the Attachment&apos; -Body &quot;Forgot to send the attachment. Sending now.&quot; -Attachments .\\data.csv -Priority High -DeliveryNotificationOption OnSuccess, OnFailure -SmtpServer &apos;smtp.fabrikam.com&apos;\n<\/code><\/pre>\n<ul>\n<li>\n<p><span style=\"font-weight: bold;\">Create symbolic link from folder to folder.<\/span><\/p>\n<\/li>\n<pre><code>move C:\\ProgramData\\docker\\* D:\\ProgramData\\docker\ncmd \/c mklink \/d C:\\ProgramData\\docker D:\\ProgramData\\docker\n\n# \/d for folder\n\n<\/code><\/pre>\n<li>\n<p><span style=\"font-size: 10pt; color: rgb(39, 39, 39); font-family: &quot;Titillium Web&quot;; font-weight: bold;\">Got path not exists<\/span><\/p>\n<\/li>\n<ul>\n<li>\n<p><span style=\"font-size: 10pt;\">Error message:<\/span><\/p>\n<p><span style=\"font-size: 13.3333px;\">&quot;<\/span><span style=\"box-sizing: border-box; white-space: pre-wrap; overflow-wrap: break-word; position: relative; font-size: 14px; background: rgb(38, 50, 56); cursor: text; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(233, 237, 237); font-family: &quot;Roboto Mono&quot;, monospace; font-variant-caps: normal; font-variant-ligatures: normal;\">{path}<\/span> <span style=\"box-sizing: border-box; white-space: pre-wrap; overflow-wrap: break-word; position: relative; font-size: 14px; background: rgb(38, 50, 56); cursor: text; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(233, 237, 237); font-family: &quot;Roboto Mono&quot;, monospace; font-variant-caps: normal; font-variant-ligatures: normal;\">No such file or directory<\/span><span style=\"font-size: 13.3333px;\">&quot;<\/span><\/p>\n<\/li>\n<li>\n<p>Remove the &quot;&quot; on the path behind `cat` command.&nbsp;<\/p>\n<p>git secrets &#8211;add-provider &#8212; cat .\/folder\/*<\/p>\n<\/li>\n<\/ul>\n<li>\n<p><span style=\"font-size: 10pt; color: rgb(39, 39, 39); font-family: &quot;Titillium Web&quot;; font-weight: bold;\">Got path not exists<\/span><\/p>\n<\/li>\n<ul>\n<li>\n<p><span style=\"font-size: 10pt;\">Error message:<\/span><\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<p><span style=\"font-size: 14pt; color: rgb(30, 204, 255); font-weight: bold;\">Windows Commands&nbsp;<\/span><\/p>\n<ul>\n<li>\n<p>\u522a\u9664 Windows service<\/p>\n<\/li>\n<\/ul>\n<pre><code>SC delete {{serviceName}}\n<\/code><\/pre>\n<\/p>\n<ul>\n<li>\n<p>\u95dc\u9589 WSUS<\/p>\n<\/li>\n<\/ul>\n<pre><code>&quot;Computer\\HKEY_LOCAL_MACHINE\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU&quot; &gt;&nbsp;UseWUServer &gt; 0\n-------\n$currentWU = Get-ItemProperty -Path &quot;HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU&quot; -Name &quot;UseWUServer&quot; | select -ExpandProperty UseWUServer\nSet-ItemProperty -Path &quot;HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU&quot; -Name &quot;UseWUServer&quot; -Value 0\nRestart-Service wuauserv\n<\/code><\/pre>\n<ul>\n<li>\n<p>Install RSAT Tools<\/p>\n<\/li>\n<\/ul>\n<pre><code># install AD management tools (including the ADUC console):\nAdd-WindowsCapability \u2013online \u2013Name \u201cRsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0\u201d\n# install DNS management console, run:\nAdd-WindowsCapability \u2013online \u2013Name \u201cRsat.Dns.Tools~~~~0.0.1.0\u201d\n# Verify\nGet-WindowsCapability -Name RSAT* -Online | Select-Object -Property DisplayName, State\n\n# Etc.\nAdd-WindowsCapability -Online -Name Rsat.FileServices.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.GroupPolicy.Management.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.IPAM.Client.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.LLDP.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.NetworkController.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.NetworkLoadBalancing.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.BitLocker.Recovery.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.CertificateServices.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.DHCP.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.FailoverCluster.Management.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.RemoteAccess.Management.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.RemoteDesktop.Services.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.ServerManager.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.Shielded.VM.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.StorageMigrationService.Management.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.StorageReplica.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.SystemInsights.Management.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.VolumeActivation.Tools~~~~0.0.1.0\nAdd-WindowsCapability -Online -Name Rsat.WSUS.Tools~~~~0.0.1.0\n\n# To install all the available RSAT tools at once, run:\nGet-WindowsCapability -Name RSAT* -Online | Add-WindowsCapability \u2013Online\n# To install only disabled RSAT components, run:\nGet-WindowsCapability -Online |? {$_.Name -like &quot;*RSAT*&quot; -and $_.State -eq &quot;NotPresent&quot;} | Add-WindowsCapability -Online\n<\/code><\/pre>\n<p><span style=\"font-size: 14pt; color: rgb(30, 204, 255); font-weight: bold;\">Windows Others<\/span><\/p>\n<ul>\n<li>\n<p>Add app to startup<\/p>\n<\/li>\n<ul>\n<li>\n<p>Win + R &gt; run &quot;shell:startup&quot;<\/p>\n<\/li>\n<li>\n<p>Add app shortcut to folder.<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<ul>\n<li>\n<p>Disable error reporting &#8211; &quot;Hold on &quot;<\/p>\n<\/li>\n<ul>\n<li>\n<p>Win + R &gt; run &quot;services.msc&quot;<\/p>\n<\/li>\n<li>\n<p>Disable service: &quot;Windows Error Reporting Service&quot;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/8b25a37b50f0ae5949bce4dc084a06b0.png\"\/><\/p>\n<\/li>\n<\/ul>\n<li>\n<p>\u95dc\u9589 telnet<\/p>\n<\/li>\n<\/ul>\n<pre><code>Ctrl + ]\ntelnet&gt; quit(q)&nbsp;&nbsp;\n<\/code><\/pre><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>PowerShell&nbsp;<\/p>\n<\/div>","protected":false},"author":1,"featured_media":1261,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-997","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PowerShell\/Windows commands (updating) - John&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/john.pentaidea.com\/?p=997\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PowerShell\/Windows commands (updating) - John&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"PowerShell&nbsp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/john.pentaidea.com\/?p=997\" \/>\n<meta property=\"og:site_name\" content=\"John&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-05-13T10:20:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/8b25a37b50f0ae5949bce4dc084a06b0.png\" \/>\n\t<meta property=\"og:image:width\" content=\"988\" \/>\n\t<meta property=\"og:image:height\" content=\"257\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"jj\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"jj\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/john.pentaidea.com\/?p=997\",\"url\":\"https:\/\/john.pentaidea.com\/?p=997\",\"name\":\"PowerShell\/Windows commands (updating) - John&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\/\/john.pentaidea.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/john.pentaidea.com\/?p=997#primaryimage\"},\"image\":{\"@id\":\"https:\/\/john.pentaidea.com\/?p=997#primaryimage\"},\"thumbnailUrl\":\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/8b25a37b50f0ae5949bce4dc084a06b0.png\",\"datePublished\":\"2019-05-13T10:20:30+00:00\",\"dateModified\":\"2019-05-13T10:20:30+00:00\",\"author\":{\"@id\":\"https:\/\/john.pentaidea.com\/#\/schema\/person\/3d2e5980a7d3023e93b91d668d2a4a4f\"},\"breadcrumb\":{\"@id\":\"https:\/\/john.pentaidea.com\/?p=997#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/john.pentaidea.com\/?p=997\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/john.pentaidea.com\/?p=997#primaryimage\",\"url\":\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/8b25a37b50f0ae5949bce4dc084a06b0.png\",\"contentUrl\":\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/8b25a37b50f0ae5949bce4dc084a06b0.png\",\"width\":988,\"height\":257},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/john.pentaidea.com\/?p=997#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/john.pentaidea.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PowerShell\/Windows commands (updating)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/john.pentaidea.com\/#website\",\"url\":\"https:\/\/john.pentaidea.com\/\",\"name\":\"John's Blog\",\"description\":\"\u4e16\u754c\u56e0\u601d\u7dd2\u800c\u8907\u96dc, \u4eba\u56e0\u5922\u60f3\u800c\u5049\u5927\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/john.pentaidea.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/john.pentaidea.com\/#\/schema\/person\/3d2e5980a7d3023e93b91d668d2a4a4f\",\"name\":\"jj\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/john.pentaidea.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a685414cd92056415bc823b5cfbbf95a44a98df88d8c040b18613724c1c0724b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a685414cd92056415bc823b5cfbbf95a44a98df88d8c040b18613724c1c0724b?s=96&d=mm&r=g\",\"caption\":\"jj\"},\"sameAs\":[\"https:\/\/john.pentaidea.com\"],\"url\":\"https:\/\/john.pentaidea.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PowerShell\/Windows commands (updating) - John&#039;s Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/john.pentaidea.com\/?p=997","og_locale":"en_US","og_type":"article","og_title":"PowerShell\/Windows commands (updating) - John&#039;s Blog","og_description":"PowerShell&nbsp;","og_url":"https:\/\/john.pentaidea.com\/?p=997","og_site_name":"John&#039;s Blog","article_published_time":"2019-05-13T10:20:30+00:00","og_image":[{"width":988,"height":257,"url":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/8b25a37b50f0ae5949bce4dc084a06b0.png","type":"image\/png"}],"author":"jj","twitter_card":"summary_large_image","twitter_misc":{"Written by":"jj","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/john.pentaidea.com\/?p=997","url":"https:\/\/john.pentaidea.com\/?p=997","name":"PowerShell\/Windows commands (updating) - John&#039;s Blog","isPartOf":{"@id":"https:\/\/john.pentaidea.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/john.pentaidea.com\/?p=997#primaryimage"},"image":{"@id":"https:\/\/john.pentaidea.com\/?p=997#primaryimage"},"thumbnailUrl":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/8b25a37b50f0ae5949bce4dc084a06b0.png","datePublished":"2019-05-13T10:20:30+00:00","dateModified":"2019-05-13T10:20:30+00:00","author":{"@id":"https:\/\/john.pentaidea.com\/#\/schema\/person\/3d2e5980a7d3023e93b91d668d2a4a4f"},"breadcrumb":{"@id":"https:\/\/john.pentaidea.com\/?p=997#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/john.pentaidea.com\/?p=997"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/john.pentaidea.com\/?p=997#primaryimage","url":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/8b25a37b50f0ae5949bce4dc084a06b0.png","contentUrl":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/8b25a37b50f0ae5949bce4dc084a06b0.png","width":988,"height":257},{"@type":"BreadcrumbList","@id":"https:\/\/john.pentaidea.com\/?p=997#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/john.pentaidea.com\/"},{"@type":"ListItem","position":2,"name":"PowerShell\/Windows commands (updating)"}]},{"@type":"WebSite","@id":"https:\/\/john.pentaidea.com\/#website","url":"https:\/\/john.pentaidea.com\/","name":"John's Blog","description":"\u4e16\u754c\u56e0\u601d\u7dd2\u800c\u8907\u96dc, \u4eba\u56e0\u5922\u60f3\u800c\u5049\u5927","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/john.pentaidea.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/john.pentaidea.com\/#\/schema\/person\/3d2e5980a7d3023e93b91d668d2a4a4f","name":"jj","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/john.pentaidea.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a685414cd92056415bc823b5cfbbf95a44a98df88d8c040b18613724c1c0724b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a685414cd92056415bc823b5cfbbf95a44a98df88d8c040b18613724c1c0724b?s=96&d=mm&r=g","caption":"jj"},"sameAs":["https:\/\/john.pentaidea.com"],"url":"https:\/\/john.pentaidea.com\/?author=1"}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/8b25a37b50f0ae5949bce4dc084a06b0.png","_links":{"self":[{"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/posts\/997","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=997"}],"version-history":[{"count":0,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/posts\/997\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/media\/1261"}],"wp:attachment":[{"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=997"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=997"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=997"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}