Snippets Collections

# generate public key using Powershell
# email at the end is just a signature that you created it
ssh-keygen -t rsa -b 4096 -C "olegserdia@gmail.com"


# if you see an error: WARNING: UNPROTECTED PRIVATE KEY FILE!
# then cd to a folder with files and run this in PS:
icacls * /reset /t /c /q   # https://superuser.com/questions/106181/equivalent-of-chmod-to-change-file-permissions-in-windows

# start the ssh-agent in the background using GIT
eval "$(ssh-agent)"

# using GIT add private key to SSH agent: (PowerShell does not work for some reason)
ssh-add ~/.ssh id_rsa

# add public key to a GitHub repository: Left top corner--> settings

# Clone repository using GIT
git clone git@github.com:Serdia/azure-resume.git

######################################################################
# Troubleshooting

# add Private key to ssh agent using PS
ssh-add C:/Users/oserdyuk/.ssh/id_rsa.pub

#if error: Error loading key "C:/Users/oserdyuk/.ssh/id_rsa.pub": invalid format
# you can either overrite key in a right format: (it changes email to oserdyuk@oserdyuk-vm - not sure why)
ssh-keygen -f C:/Users/oserdyuk/.ssh/id_rsa.pub   # click Enter to ignore password

git clone git@github.com:ACloudGuru-Resources/acg-project-azure-resume-starter.git

# to remove keys from SSH agent
ssh-add -D

# service OpenSSH Authentification Agent. Make sure it's running.
C:\WINDOWS\System32\OpenSSH\ssh-agent.exe
# start service in powershell
Start-Service -Name "OpenSSH Authentication Agent"

# start the ssh-agent in the background
eval "$(ssh-agent)"


echo "$(ssh-agent)"

# check whether agent is running or not (GIT)
if ps -p $SSH_AGENT_PID > /dev/null
then
   echo "ssh-agent is already running"
   # Do something knowing the pid exists, i.e. the process with $PID is running
else
eval `ssh-agent -s`
fi


# list all keys that are present in the agent PS or GIT
ssh-add -l



# overwrite the key. Just please enter (to ignore password)
 ssh-keygen -f C:/Users/oserdyuk/.ssh/id_rsa.pub

ssh-add -L # copy the key, place it into GitHub. Worked



ssh-add "C:/Users/oserdyuk/.ssh/id_rsa.pub.pub"  -- Error loading key. Invalid format

ssh-add ~/.ssh my_id_rsa
# view content of the folder
$reportServerUri = 'http://10.36.8.17/ReportServer/'
$folderName = "/AFH/Align General/Programs"
Get-RsFolderContent -ReportServerUri $reportServerUri -RsFolder $folderName | Format-Table -AutoSize


# Return existing data source information for "GrossBudget" report. If multiple datasources uses for queries - it will return all of them. 
$ReportPortalUri = "http://10.36.8.17/Reports"
Get-RsRestItemDataSource -RsItem "/AFH/GrossBudget" -ReportPortalUri $ReportPortalUri

# Get connection string info for "Construction - AY Loss Ratios" report
$ReportPortalUri = "http://10.36.8.17/Reports"
Get-RsRestItemDataSource -RsItem "/AFH/Align General/Programs/Construction - AY Loss Ratios" -ReportPortalUri $ReportPortalUri
---------------------------------------------------------------------------------------------------
# change connection string for Catalytic reports using catalyticSSRS username
$ReportPortalUri = "http://10.36.8.17/Reports"
$ReportName = '/AFH/Catalytic/Underwriter Reports/Underwriter Production'
$Username = 'catalyticSSRS'
$Password = 'RND1101!'
$ServerName = '10.36.8.18'
# grab parameters that are currently exists in a report
$parameters = Get-RsRestItemDataModelParameters $ReportName -ReportPortalUri $ReportPortalUri
$parameters
# Map to a dictionary to access the parameter values.
$parameterdictionary = @{}
foreach ($parameter in $parameters) { $parameterdictionary.Add($parameter.Name, $parameter); }
# change parameter value
$parameterdictionary[“ServerName”].Value = $ServerName
# update parameters that are currentl in a report
Set-RsRestItemDataModelParameters -RsItem $ReportName -ReportPortalUri $ReportPortalUri -DataModelParameters $parameters
# print what changed
$parameterdictionary.Values
# set authentification mode, username and password
$dataSources = Get-RsRestItemDataSource -RsItem $ReportName -ReportPortalUri $ReportPortalUri
$dataSources[0].DataModelDataSource.AuthType = 'UsernamePassword' # UsernamePassword should be used when specifying SQL or Basic Credentials
$dataSources[0].DataModelDataSource.Username = $Username
$dataSources[0].DataModelDataSource.Secret = $Password
Set-RsRestItemDataSource -RsItem $ReportName -RsItemType PowerBIReport -DataSources $datasources
Get-Content "\\fs01\Align\Public\OLEGSQLSWITCH\Servers.txt" |
     ForEach-Object{
          if(Test-Connection $_ -Count 1 -quiet){
               "$_ Up"
          }else{
               "$_ Down"
          }
     } 
star

Tue Jun 21 2022 23:59:51 GMT+0000 (UTC)

#powershell #ping
star

Tue May 24 2022 20:02:11 GMT+0000 (UTC)

#powershell #ping

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension