powershell

Invoke-ASCmd : Authentication failed: User ID and Password are required when user interface is not available

混江龙づ霸主 提交于 2021-01-25 04:02:50
问题 I am trying to refresh credentials of an (already)deployed Tabular Model via CICD using Azure DevOps. Making use of Invoke-ASCmd in PowerShell to refresh the credentials. The script works fine from local when I provide the Tenant ID, App ID and the Key. However it fails when I run it from Azure Devops with error - User ID and Password are required when user interface is not available. Here is the script: $azureTenantId= "TenantId" $azurePassword = ConvertTo-SecureString "Key" -AsPlainText

Invoke-ASCmd : Authentication failed: User ID and Password are required when user interface is not available

这一生的挚爱 提交于 2021-01-25 03:50:29
问题 I am trying to refresh credentials of an (already)deployed Tabular Model via CICD using Azure DevOps. Making use of Invoke-ASCmd in PowerShell to refresh the credentials. The script works fine from local when I provide the Tenant ID, App ID and the Key. However it fails when I run it from Azure Devops with error - User ID and Password are required when user interface is not available. Here is the script: $azureTenantId= "TenantId" $azurePassword = ConvertTo-SecureString "Key" -AsPlainText

Is there a way to get VMs Operating System name from Hyper-V using powershell?

房东的猫 提交于 2021-01-24 21:48:26
问题 I'm writing a script on HYPER-V host for getting VMs guest informations. Is there a way to get VMs Operating System name from Hyper-V using powershell? There are several examples using (Get-WmiObject Win32_OperatingSystem -ComputerName $vmName).name but i should get this information directly from Hyper-V because of domain restrictions. Also i'm using hyper-v module of powershell but i couldn't see any cmdlets related to OS. 回答1: This could be retrieved from guest intrinsic exchange items. #

How to create System.IO.StreamWriter with Encoding in Powershell?

丶灬走出姿态 提交于 2021-01-24 11:59:29
问题 I'm trying to create instance of StreamWriter with UTF8 encoding in PowerShell. $f = New-Object System.IO.StreamWriter "a.txt", $false, [System.Text.Encoding]::UTF8 This throws error: New-Object : Cannot find an overload for "StreamWriter" and the argument count: "3". I'm trying to invoke this constructor: https://msdn.microsoft.com/en-us/library/f5f5x7kt(v=vs.110).aspx 回答1: Still, I would like to know what is wrong with my original syntax. Your original syntax (fundamentally correctly) uses

How to move folders into subfolders with name of first character of the folder to move with support for Unicode characters in folder names?

会有一股神秘感。 提交于 2021-01-24 07:17:21
问题 I use this batch script written by Mofi to move folders into other folders. @echo off setlocal EnableExtensions DisableDelayedExpansion %SystemRoot%\System32\tree.com for /F "eol=| delims=" %%I in ('dir /AD /B 2^>nul') do ( set "FolderName=%%I" setlocal EnableDelayedExpansion set "TargetFolder=!FolderName:~0,1!" if not "!TargetFolder!" == "!FolderName!" ( md "!TargetFolder!" 2>nul move /-Y "!FolderName!" "!TargetFolder!\" ) endlocal ) %SystemRoot%\System32\tree.com endlocal It moves folders

is there a way to use the equivalent of touch in powershell to update time stamps of a file?

瘦欲@ 提交于 2021-01-24 07:16:37
问题 I use the unix command 'touch' a lot to update time-stamps of any new acquired/downloaded file in my system. Many a times the time-stamp of the existing file is old so it can get lost in the system. Is there a way in MS-Windows powershell to do so. I have both powershell 5 as well as powershell 6. 回答1: You can use $file = Get-Item C:\Intel\Logs\IntelCpHDCPSvc.log $file.LastWriteTime = (Get-Date) Or CreationTime or LastAcccessTime, if you prefer. As a function Function

How to move folders into subfolders with name of first character of the folder to move with support for Unicode characters in folder names?

被刻印的时光 ゝ 提交于 2021-01-24 07:16:20
问题 I use this batch script written by Mofi to move folders into other folders. @echo off setlocal EnableExtensions DisableDelayedExpansion %SystemRoot%\System32\tree.com for /F "eol=| delims=" %%I in ('dir /AD /B 2^>nul') do ( set "FolderName=%%I" setlocal EnableDelayedExpansion set "TargetFolder=!FolderName:~0,1!" if not "!TargetFolder!" == "!FolderName!" ( md "!TargetFolder!" 2>nul move /-Y "!FolderName!" "!TargetFolder!\" ) endlocal ) %SystemRoot%\System32\tree.com endlocal It moves folders

How to move folders into subfolders with name of first character of the folder to move with support for Unicode characters in folder names?

久未见 提交于 2021-01-24 07:15:48
问题 I use this batch script written by Mofi to move folders into other folders. @echo off setlocal EnableExtensions DisableDelayedExpansion %SystemRoot%\System32\tree.com for /F "eol=| delims=" %%I in ('dir /AD /B 2^>nul') do ( set "FolderName=%%I" setlocal EnableDelayedExpansion set "TargetFolder=!FolderName:~0,1!" if not "!TargetFolder!" == "!FolderName!" ( md "!TargetFolder!" 2>nul move /-Y "!FolderName!" "!TargetFolder!\" ) endlocal ) %SystemRoot%\System32\tree.com endlocal It moves folders

Multiple csv files into a xlsx file but different sheets using powershell

一个人想着一个人 提交于 2021-01-24 03:33:16
问题 I have 20 csv files. Each are unrelated. How do I combine them together into one xlsx file with 20 sheets, each named after the csv files. $root = "C:\Users\abc\Desktop\testcsv" $CSVfiles = Get-ChildItem -Path $root -Filter *.csv $xlsx = "C:\Users\abc\Desktop\testxl.xlsx" #output location $delimiter = "," #delimiter #Create a excel $xl=New-Object -ComObject Excel.Application $xl.Visible=$true #add a workbook $wb=$xl.WorkBooks.add(1) ForEach ($csv in $CSVfiles){ #name the worksheet $ws=$wb

Multiple csv files into a xlsx file but different sheets using powershell

≯℡__Kan透↙ 提交于 2021-01-24 03:23:35
问题 I have 20 csv files. Each are unrelated. How do I combine them together into one xlsx file with 20 sheets, each named after the csv files. $root = "C:\Users\abc\Desktop\testcsv" $CSVfiles = Get-ChildItem -Path $root -Filter *.csv $xlsx = "C:\Users\abc\Desktop\testxl.xlsx" #output location $delimiter = "," #delimiter #Create a excel $xl=New-Object -ComObject Excel.Application $xl.Visible=$true #add a workbook $wb=$xl.WorkBooks.add(1) ForEach ($csv in $CSVfiles){ #name the worksheet $ws=$wb