Jump to content

Recommended Posts

Posted

Hi guys,

This is driving me mad...

I want to deploy BGInfo as an app to all intune systems to show some info on the desktop of each system on the network.

 

There are several really helpful guides online which go through how to set it up.

I went with this one.

 

I keep on getting fails with this error: The system cannot find the file specified. (0x80070002).

I have checked all of my file names, everything looks good.

 

If I run the install command on a test system, I am getting errors.

Here is the install command:

%windir%system32windowspowershellv1.0powershell.exe -executionpolicy bypass -file "Install_BgInfo.ps1"

 

The error was:

Screenshot 2024-11-28 125405.png

 

 

With this in mind, I changed the install and uninstall commands to:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -file "Install_BgInfo.ps1"

It liked this when I manually ran this on a test system, but again, after updating this on the App settings in Intune, I am getting the same 0x80070002 error.

 

Any ideas? I have checked the way I have packaged the app using the Intune Win App Util and I can't see that I have missed anything. Wasting so much time on this but I know I am close!

Posted (edited)
You are missing some \ in the command. Looks like they are stipped from the guide you are following. it should be:

 

%windir%\system32\windowspowershellv1.0powershell.exe -executionpolicy bypass -file "Install_BgInfo.ps1"

 

Thank you, I tried your suggestion, but still a fail. So changed it to:

%windir%\system32\windowspowershell\v1.0\powershell.exe -executionpolicy bypass -file "Install_BgInfo.ps1"

 

But it still doesn't seem to like it. Going to play around with it a little more just in case something is missing or there is a space where there shouldn't be.

Edited by talksr
Posted

Unfortunately, it still fails. What I find is if I try and run part of the install on a client station, I keep on getting the following error:

 

Screenshot 2024-11-28 131614.png

Posted
I think %windir% puts a \ at the end, so it would resolve to C:\Windows\\System32

 

Thank you, just tried that too but still giving me a fail.

Posted

All of my Intune apps install with the following command: %SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe -windowstyle hidden -executionpolicy bypass -command .\Install.ps1

 

There is obviously no space in powershell.exe

  • Thanks 1
Posted

Thank you everyone for the helpful posts. I haven't made my way through all of them yet but just replying to the first set now....

 

Do you really need to use % if all the devices are the same. Have you tried: C:\Windows\system32\windowspowershell\v1.0\powershell.exe -executionpolicy bypass -file "Install_BgInfo.ps1"

 

So yes, in my OP that is what I was using in the App install and uninstall command. If I ran it from Powershell on a station, it worked perfectly, but is resulting in a fail when I deploy so thought I had better check I have not missed anything.

 

What do you get if you type echo %windir% in cmd?

%windir% :)

 

No, but going to have a look this morning, thank you for this.

 

Just try - you don't need all the extra when deploying apps. I've deployed multiple scripts/apps the below way

powershell -ep bypass -file .\Install_BgInfo.ps1

 

Ok, thanks, not tried this but will give it a whizz this morning and see if it works.

Thank you for all of the help on this. I don't usually run into issues that just won't resolve so I am assuming it must be something very small like a space or something missing somewhere, which is usually the case!

Posted

A quick update to my last post.

If I change the install command to the following:

C:\Windows\system32\windowspowershell\v1.0\powersh ell.exe -executionpolicy bypass -file "Install_BgInfo.ps1"

 

If I use PS, it likes this, however, there seems to be an issue with the Install_BgInfo ps file.

This is the error I am seeing:

Screenshot 2024-11-29 121402.png

 

If I look at the PS file, the line it would seen to be referring to is this:

 

LN13.png

 

Does anyone know what I might be able to tweak to get it to accept the creation of the shortcut?

Posted

Are you running it as Admin?

 

Also, you need a '\' at the createshortcut command: $Shortcut = $WScriptShell.CreateShortcut($strCommonStartup + "\BgInfo.lnk")

  • Thanks 1
Posted
Are you running it as Admin?

 

Also, you need a '\' at the createshortcut command: $Shortcut = $WScriptShell.CreateShortcut($strCommonStartup + "\BgInfo.lnk")

 

Thank you, I was running it via VS Code so I would assume it was running as admin.

I have made changes to the code and now it is working.

New code is as follows:

# Create Directory
New-Item -Path "C:\BgInfo" -ItemType "directory" -Force

# Copy files into the BgInfo folder on the destination devices
Copy-Item -Path ".\Bginfo64.exe" -Destination "C:\BgInfo" -Force
Copy-Item -Path ".\template_matrixpost.bgi" -Destination "C:\BgInfo" -Force

$WshShell = New-Object -comObject WScript.Shell
$strCommonStartup = $WshShell.SpecialFolders("AllUsersStartup")
$ShortcutPath = $strCommonStartup + "\BgInfo.lnk"

# Try to create the shortcut and handle any access exceptions
try {
   $Shortcut = $WshShell.CreateShortcut($ShortcutPath)
   $Shortcut.TargetPath = "C:\BgInfo\Bginfo64.exe"
   $Shortcut.Arguments = "C:\BgInfo\template_matrixpost.bgi /SILENT /TIMER:0 /NOLICPROMPT"
   $Shortcut.Save()
   Write-Output "Shortcut successfully created"
} catch {
   Write-Error "Unable to save shortcut: $_"
   exit 1
}

# Return optional a status code if installation was successfully
# Determine if BgInfo is successfully installed
$BgInfoIsInstalled = Test-Path -Path "C:\BgInfo\Bginfo64.exe"

if ($BgInfoIsInstalled) {
   Write-Output "BgInfo successfully installed"
   exit 0
} else {
   Write-Output "Some issues occurred when installing BgInfo"
   exit 1
}

 

No more errors shown on Intune and the app package is deploying however, the BgInfo is not showing on the user desktop.

If I visit a station it shows has successfully installed the app, I can see there is a C:\BgInfo folder and within it there is:

Bginfo64.exe

template_matrixpost.bgi

 

I wonder what is stopping it from executing for each user.

Posted
Thank you, I was running it via VS Code so I would assume it was running as admin.

I have made changes to the code and now it is working.

New code is as follows:

# Create Directory
New-Item -Path "C:\BgInfo" -ItemType "directory" -Force

# Copy files into the BgInfo folder on the destination devices
Copy-Item -Path ".\Bginfo64.exe" -Destination "C:\BgInfo" -Force
Copy-Item -Path ".\template_matrixpost.bgi" -Destination "C:\BgInfo" -Force

$WshShell = New-Object -comObject WScript.Shell
$strCommonStartup = $WshShell.SpecialFolders("AllUsersStartup")
$ShortcutPath = $strCommonStartup + "\BgInfo.lnk"

# Try to create the shortcut and handle any access exceptions
try {
   $Shortcut = $WshShell.CreateShortcut($ShortcutPath)
   $Shortcut.TargetPath = "C:\BgInfo\Bginfo64.exe"
   $Shortcut.Arguments = "C:\BgInfo\template_matrixpost.bgi /SILENT /TIMER:0 /NOLICPROMPT"
   $Shortcut.Save()
   Write-Output "Shortcut successfully created"
} catch {
   Write-Error "Unable to save shortcut: $_"
   exit 1
}

# Return optional a status code if installation was successfully
# Determine if BgInfo is successfully installed
$BgInfoIsInstalled = Test-Path -Path "C:\BgInfo\Bginfo64.exe"

if ($BgInfoIsInstalled) {
   Write-Output "BgInfo successfully installed"
   exit 0
} else {
   Write-Output "Some issues occurred when installing BgInfo"
   exit 1
}

 

No more errors shown on Intune and the app package is deploying however, the BgInfo is not showing on the user desktop.

If I visit a station it shows has successfully installed the app, I can see there is a C:\BgInfo folder and within it there is:

Bginfo64.exe

template_matrixpost.bgi

 

I wonder what is stopping it from executing for each user.

 

What happens if you manually run the shortcut? Do you get an error. Test it as a normal user and admin user. View the properties of the shortcut to see if it has the correct arguments applied to it.

 

If you have app locker setup you might be blocking exe's from running in the C drive. Might have to copy the files to Program Files as Program Files is usually setup to allow exe's to run in app locker.

  • Thanks 1
Posted
What happens if you manually run the shortcut? Do you get an error. Test it as a normal user and admin user. View the properties of the shortcut to see if it has the correct arguments applied to it.

 

If you have app locker setup you might be blocking exe's from running in the C drive. Might have to copy the files to Program Files as Program Files is usually setup to allow exe's to run in app locker.

 

Thanks for your post.

I have never configured App Locker, but have had a look on one of the test machines and it doesn't look to be running:

Screenshot 2024-11-29 150631.png

 

If I visit the area where I have created the shortcut, it is there as expected, all of the shortcut details look good:

Screenshot 2024-11-29 150820.png

 

Screenshot 2024-11-29 150811.png

 

If I click it... nothing happens, but it is mean to run silently and I don't think BgInfo doesn't take affect until the system reboots. If I reboot, I get nothing on the desktop. If I run it as admin, same thing.

 

If I go to C:\BgInfo and open either Bginfo.exe template_matrixpost.bgi they are opening fine and I can see from the bgi file, all of my configurations are there so it has all come across as expected.

 

I am feeling like I am so close here, but still something stopping this!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...