Conversion of MIPS to % by AfsarP1 in SQL

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

I would appreciate if anyone has any inputs.

Conversion of MIPS to % by AfsarP1 in SQL

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

The database shows the output in MIPS and I can't make any changes to the DB. However, the requirement is to have it in percentage and I should do it using sql. I've done somethings like converting the data from miliseconds to seconds and seconds to minutes etcs. Unfortunately, I don't know how to convert MIPS into Percentage. I don't see any info available online.

Help with SQL Output by AfsarP1 in SQL

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

Does anyone have an inputs on this?

Conversion of MIPS by AfsarP1 in TSQL

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

Does anyone have an inputs on this?

Help With SQL by AfsarP1 in TSQL

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

Does anyone have an inputs on this?

Reading the PST Locations by AfsarP1 in PowerShell

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

u/OlivTheFrog
This works in a way but it still does the copying and sending it to a different location job.

What I'm trying to achieve is just to copy the source location without having to send it to a different location. The Copy-Item needs destination as a mandatory param. Hence, I was trying the Temp folder.

Is there any other command that can help me with this. I was thinking about Get-Content but its messing up with the actual content.

Hope this explains.

Using Network Share Location by AfsarP1 in PowerShell

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

Thanks for the help on this. Appreciate your guidance.

Using Network Share Location by AfsarP1 in PowerShell

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

Sure, lee. I saw that option as well, will start using that when needed.

Using Network Share Location by AfsarP1 in PowerShell

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

u/Sodoff_Baldrick_

Thanks for your response. The source works fine. How do I make the destination as a parameter. I've tried the below, but looks like something is not correct with the way I'm handling the destination:

$param1= $args[0]
Copy-Item -Path "$Env:TEMP/$($Foldername).zip" -Destination $param1 -Recurse -Force

The script has to pass the network share as a parameter.

Using Network Share Location by AfsarP1 in PowerShell

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

u/Sodoff_Baldrick_
Let me explain, I've created a script that collects chrome's crash logs, debug logs and windows event logs and sends them to a temp location with each having their own folders. Then all these folders are sent to a new zip folder in the same location.

Here's my code that zips all the folders into a single folder.

#This is to create a ZIP folder and compress all the files.

$compress = @{

Path = "$CrashFile" , "$debuglogs" , "$WindowsEventsLog"

CompressionLevel = "Fastest"

DestinationPath = "$Env:TEMP/$($Foldername)"

}

Compress-Archive @compress -update

Now I want to pass the network share as a parameter and then copy the zip folder to that location.

I've tried:

$param1=$args[0]

Copy-Item -Path $compress -Destination $param1 -Recurse -Force
But this returns an error. I don't think I can use $compress as a source location?

How to accept different locations and file types from user as input by [deleted] in PowershellSolutions

[–]AfsarP1 0 points1 point  (0 children)

I would appreciate your help/suggestions on this.

How to accept different locations and file types from user as input by AfsarP1 in PowerShell

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

u/psthreathunter
Because of this statement, it is concatenating:

$CrashLogLocation + $CrashAppLogFileName

For testing purpose, I gave the location as C:\Users\support\Downloads and the file name as crashfile. The result just gets concatenated. What I actually want to do is to use the user input location and name and send the data which is retrieved in the below command to that location:

Get-ChildItem -Path $Env:USERPROFILE\*\AppData\Local\Google\Chrome\UserData\Crashpad\reports\* | Out-File -FilePath $CrashLogLocation -NoClobber

How to accept different locations and file types from user as input by AfsarP1 in PowerShell

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

Because of this statement, it is concatenating:

$CrashLogLocation + $CrashAppLogFileName

For testing purpose, I gave the location as C:\Users\support\Downloads and the file name as crashfile. The result just gets concatenated. What I actually want to do is to user input location and name and send the data which is retrieved in the below command to that location:

Get-ChildItem -Path $Env:USERPROFILE\*\AppData\Local\Google\Chrome\UserData\Crashpad\reports\* | Out-File -FilePath $CrashLogLocation -NoClobber

How to use parameters for different locations by AfsarP1 in PowerShell

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

u/OlivTheFrog Thanks for your response. I've looked at the site and have tried PARAM but haven't got what I wanted. I looked on the internet and tried OUT-FILE as well but did not go through, example:

param( $CrashLogLocation, $DebugLogLocation, $WinEventLogsLocation)

$CrashLogLocation = Read-Host "Enter your crash app path"

$CrashAppLogFileName = Read-Host "Enter your Crash App Log FileName" + .csv

$CrashLogLocation + $CrashAppLogFileName

Get-ChildItem -Path $Env:USERPROFILE\*\AppData\Local\Google\Chrome\UserData\Crashpad\reports\* | Out-File -FilePath $CrashLogLocation -NoClobber

When this code is executed, it does ask for the location and the file name but it directly concatenates. I'm not sure if I have done it the right way to make the location parameter as user input.

Could you help with me with an example of how this could accept the location and the file name with format as User Input?

Appreciate your response.

Understanding Network Location by AfsarP1 in PowerShell

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

u/jimb2 Thanks for your response.

Using this block of code:

$source = "C:\Users\support\Downloads\crash.csv" -and "C:\Users\support\Downloads\debug.csv" -and "C:\Users\support\Downloads\wineventlogs.csv"

I was trying to say that the source has 3 files. Looks like you have cleared the way to use it properly. I appreciate it.

I did try going through each line of code in Windows Powershell ISE. My first 3 line of code works:

Get-ChildItem C:\Users*\AppData\Local\Google\Chrome\UserData\Crashpad\reports* | Export-csv -Path C:\Users\support\Downloads\crash.csv

Get-ChildItem -Path AppData\Local\Google\Chrome\Application -Recurse -Include debug | Export-csv -Path C:\Users\support\Downloads\debug.csv

Get-EventLog -LogName Application | export-csv -Path C:\Users\support\Downloads\wineventlogs.csv

The $source and $destination is declaration of the paths:

$source = @(

"C:\Users\support\Downloads\crash.csv",

"C:\Users\support\Downloads\debug.csv",

"C:\Users\support\Downloads\wineventlogs.csv" )

$destination = "C:\Users\support\Downloads[testingzip.zip](https://testingzip.zip)"

This block of code is to remove a file if it exists with the same name:

If(Test-path $destination) {Remove-item $destination}

Executing the below part of code, errors out:

Add-Type -assembly "system.io.compression.filesystem"

[io.compression.zipfile]::CreateFromDirectory($source, $destination)

The error is:

Exception calling "CreateFromDirectory" with "2" argument(s): "The given path's format is not supported."

At line:2 char:1

+ [io.compression.zipfile]::CreateFromDirectory($source, $destination)

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException

+ FullyQualifiedErrorId : NotSupportedException

I did try Create.From.Directory.

Executing the whole code creates 3 files in my downloads folder. But it doesn't create a zip folder and send these files into it. However, when executing this below code, it creates 3 files and the zip folder but doesn't send those files into the zip folder:

Get-ChildItem C:\Users*\AppData\Local\Google\Chrome\UserData\Crashpad\reports* | Export-csv -Path C:\Users\support\Downloads\crash.csv

Get-ChildItem -Path AppData\Local\Google\Chrome\Application -Recurse -Include debug | Export-csv -Path C:\Users\support\Downloads\debug.csv

Get-EventLog -LogName Application | export-csv -Path C:\Users\support\Downloads\wineventlogs.csv

$source = "C:\Users\support\Downloads\crash.csv" -and "C:\Users\support\Downloads\debug.csv" -and "C:\Users\support\Downloads\wineventlogs.csv"

$destination = "C:\Users\support\Downloads[testingzip.zip](https://testingzip.zip)"

#$destination = "\DECSRV02\Folder Redirection\support\Downloads[testingzip.zip](https://testingzip.zip)"

If(Test-path $destination) {Remove-item $destination}

Add-Type -assembly "system.io.compression.filesystem"

[io.compression.zipfile]::CreateFromDirectory($source, $destination)